Gun works in baseplate, but not in game?

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
1 Like

Can you give the script that assigns the gun to the player?

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

I’m sorry if the code is messy.

Make sure you are not missing any sounds the gun uses?
Also make sure the raycast script is server sided?

the sounds are fine, it’s the raycasting/killing itself, it works in a baseplate, but not in the game.