Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Does anyone here know how to make a gun with a model? I just cant seem to get it working!

Asked by 6 years ago

Does anyone here know how to make a gun? Note that I am not using a tool and that it is a model that is welded to the players hand.

If you do know the please do tell me.

Thanks.

:D

Btw here's what I've done so far with my script

local Player = game.Players.LocalPlayer
local Chara = Player.Character
local Mouse = Player:GetMouse()
local Reloading = false
local FireEvent = script.Parent.FireEvent

function Reload()
        if Reloading == true then
            print("Broke")
            return
        end
        Reloading = true
        print("Reloading")
        local Ammo = script.Parent.Ammo
        local MaxAmmo = script.Parent.MaxAmmo
        local Sound = script.Parent.Handle1.Reload
        if Ammo.Value < MaxAmmo.Value then
            Sound:Play()
            wait(0.6)
            Sound:Stop()
            wait(2)
            Ammo.Value = MaxAmmo.Value
            Sound:Play()
        end
        wait(1)
        Reloading = false
end

function Fire()
    local Aim = Mouse.Hit
    local Ammo = script.Parent.Ammo
    local MaxAmmo = script.Parent.MaxAmmo
    if Ammo.Value == 0 then
        Reload()
        return
    end
    FireEvent:FireServer(Aim)
    print(Aim)
    print("Fire")
    local Sound = script.Parent.Handle1.Fire
    Sound:Play()
end

Mouse.KeyDown:connect(function(Key)
    if Key == "r" then
        Reload()
    end
end)

Mouse.Button1Down:connect(function(mou)
    Fire()
end)
0
We don't know what ur trying todo. Or want help with. This isnt a place to ask for people to finish ur scripts. But rather a website to get help and answers ;_: casper123123123 357 — 6y
0
sry im not really an answerer, my answers usually get disliked Konethorix 197 — 6y
0
I don't know how to make on everything without a tool, why not use a tool though? You can disable dropping and disable core guis to make it seem like a first person shooter. I'm not going to tell you exact script but on the ROBLOX Wiki there is a raycasting gun how to. As for ammo I recommend putting a number value inside the gun and using that as ammo. Then, set up a GUI and set off locals INSID TheFierceWaffle 64 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Lol my comment was too big and I realized I wasn't making a seperate answer, sorry. Anyways on roblox wiki it tells you how to make a raycasting gun. You can put a number value inside the gun for ammo, guis inside the playergui, and local them INSIDE the gun script. Why don't you just use a tool? You can disable dropping and disable core GUI.

Ad

Answer this question