Passing Values through fireserver

Im trying to pass values through a fire server, and to do this I used paramters as so:

	for i,v in pairs(script.Parent.Parent.ViewportFrame:GetDescendants()) do
		if v:IsA("Tool") then
			game.ReplicatedStorage.AddGun:FireServer(game.Players.LocalPlayer, v.Name)
			break	
		end
	end

But for somreason when the even its called on the server side it does not even start what is in the code?

Here is when I call the even on the serverside:

game.ReplicatedStorage.AddGun.OnServerEvent:Connect(function(plr,gunname)
	print("ass")
	for i,v in pairs(plr.Backpack:GetDescendants()) do
		if v:IsA("Tool") then if v.Gun.Value == true then v:Destroy()break end end end	

	for i,v in pairs(plr.Character:GetDescendants()) do
		if v:IsA("Tool") then if v.Gun.Value == true then v:Destroy() break end end end
	
	for i,v in pairs(game.ReplicatedStorage.Weapons:GetChildren()) do
		if v:IsA("Tool") then
			if v.Name == gunname then
				local idkf = v:Clone()
				idkf.Parent = plr.Backpack
			end
		end
	end
end)

https://create.roblox.com/docs/scripting/events/remote#client-server

Change

game.ReplicatedStorage.AddGun:FireServer(game.Players.LocalPlayer, v.Name)

To

game.ReplicatedStorage.AddGun:FireServer(v.Name)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.