i am making a gun for my game, and i used alvinblox’s gun with a few changes (sound, delays, etc.)
i tested it alot, and it works perfectly fine in a baseplate, but in the actual game it plays a sound but doesn’t actually kill the player, here is the model: https://web.roblox.com/library/6883504966/Gun
the gun works if i put it in the starterpack, but it won’t work if i make a script to automatically assign it to the player, but in the baseplate, both methods work.
rolechooser/toolgiver code:
local sheriff
-- killer
local r = math.random(1, #players)
local x = players[r]
vals.Murder.Value = x.Name
game.ReplicatedStorage.DisplayGUI:FireClient(x, x, "K") -- ROLE GUI
table.remove(players, r)
-- sheriff
local r = math.random(1, #players)
local xx = players[r]
vals.Sheriff.Value = xx.Name
game.ReplicatedStorage.DisplayGUI:FireClient(xx, xx, "S") -- ROLE GUI
sheriff = xx
table.remove(players, r)
for i, xx in pairs(players) do
game.ReplicatedStorage.DisableGUI:FireClient(xx, xx, "I") -- ROLE GUI
end
-- Match
wait(8)
local tool = x.weps.Knife:Clone()
tool.Parent = x.Backpack
local tool2 = sheriff.weps.Gun:Clone()
tool2.Parent = sheriff.Backpack
Hi! sorry i took so long! i was away from my pc for a week, anyways, here is the script, it isn’t the complete script, but it is the role chooser and the tool giver:
local sheriff
-- killer
local r = math.random(1, #players)
local x = players[r]
vals.Murder.Value = x.Name
game.ReplicatedStorage.DisplayGUI:FireClient(x, x, "K") -- ROLE GUI
table.remove(players, r)
-- sheriff
local r = math.random(1, #players)
local xx = players[r]
vals.Sheriff.Value = xx.Name
game.ReplicatedStorage.DisplayGUI:FireClient(xx, xx, "S") -- ROLE GUI
sheriff = xx
table.remove(players, r)
for i, xx in pairs(players) do
game.ReplicatedStorage.DisableGUI:FireClient(xx, xx, "I") -- ROLE GUI
end
-- Match
wait(8)
local tool = x.weps.Knife:Clone()
tool.Parent = x.Backpack
local tool2 = sheriff.weps.Gun:Clone()
tool2.Parent = sheriff.Backpack