local FRAMEWORK = {}
FRAMEWORK.inv_DEFAULT = {
"Railgun",
"Handcannon",
"Gaster Blaster",
};
FRAMEWORK.cur_WEAPON = FRAMEWORK.inv_DEFAULT[2] -- Handcannon as the default weapon for anything
FRAMEWORK.cur_VIEWMODEL = "v_" .. FRAMEWORK.cur_WEAPON -- Viewmodels will ALWAYS be the weapon's viewmodel
FRAMEWORK.cur_SKIN = "The Stranded" -- Default skin
local Players = game:GetService("Players")
local PLAYER = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local fldr_MODULES = ReplicatedStorage:FindFirstChild("Modules")
local fldr_WEAPONS = ReplicatedStorage:FindFirstChild("Weapons")
local fldr_VIEWMODELS = ReplicatedStorage:FindFirstChild("Viewmodels")
local obj_ARMS = fldr_VIEWMODELS:FindFirstChild("Arms")
local fldr_SKINS = ReplicatedStorage:FindFirstChild("Skins")
w_CAMERA = workspace.CurrentCamera
function FRAMEWORK:Cast(WEAPON, pos_END, VEL)
local FLASH = WEAPON:FindFirstChild("Flash")
local CastedBullet = Instance.new("Part", workspace)
CastedBullet.Size = Vector3.new(1, 1, 5)
CastedBullet.Anchored = true
CastedBullet.CanCollide = false
CastedBullet.Color = Color3.new(219, 239, 0)
CastedBullet.Material = Enum.Material.Neon
CastedBullet.CFrame = CFrame.new(FLASH.Position, pos_END)
local LOOP
LOOP = RunService.RenderStepped:Connect(function(dt)
CastedBullet.CFrame *= CFrame.new(0, 0, -VEL * (dt * 60))
if (CastedBullet.Position - FLASH.Position).Magnitude > 5000 then
CastedBullet:Destroy()
CastedBullet:Disconnect()
end
end)
end
function FRAMEWORK:Equip(VIEWMODEL)
for i, v in pairs(w_CAMERA:GetChildren()) do
if v.Name == VIEWMODEL and v.Panret == w_CAMERA then
return -- Current equipped weapon is already parented to the camera
end
end
for i, v in pairs(fldr_VIEWMODELS:GetChildren()) do
if v.Name == VIEWMODEL then
local vm_NEW = v:Clone()
vm_NEW.Parent = w_CAMERA
local anim_EQUIP = vm_NEW.AnimationController:LoadAnimation(vm_NEW.Animations.Equip)
local sfx_EQUIP = vm_NEW:FindFirstChild("Sounds").Equip
anim_EQUIP:Play()
sfx_EQUIP:Play()
return -- Stop after equipping is done
end
end
end
function FRAMEWORK:Update(VIEWMODEL, DELTATIME)
local vm_SFX = VIEWMODEL:FindFirstChild("Sounds")
local vm_ANIMS = VIEWMODEL:FindFirstChild("Animations")
VIEWMODEL:SetPrimaryPartCFrame(w_CAMERA.CFrame)
end
return FRAMEWORK
To embed this project on your website, copy the following code and paste it into your website's HTML: