I'm making an fps game and when I tried to make a give player item script but it gave this FireServer is not a valid member of RemoteEvent.
--script local famas = game.ServerStorage.FAMAS local scarL = game.ServerStorage["SCAR-L"] local famasClone = famas:Clone() local scarLClone = scarL:Clone() local remote = Instance.new("RemoteEvent") remote.Parent = game.ReplicatedStorage remote.Name = "WeaponEvent" remote.OnServerEvent:Connect(function(plr) if famasClone.Parent ~= plr.Backpack then famasClone.Parent = plr.Backpack end if scarLClone.Parent ~= plr.Backpack then scarLClone.Parent = plr.Backpack end end)
--local scriipt local weaponRemote = game.ReplicatedStorage:WaitForChild("WeaponEvent") button.MouseButton1Click:connect(function() weaponRemote:FireSever() end)
You misspelt FireServer
as FireSever
. There is still an issue with your script.
--script local famas = game.ServerStorage.FAMAS local scarL = game.ServerStorage["SCAR-L"] local famasClone = famas:Clone() local scarLClone = scarL:Clone() local remote = Instance.new("RemoteEvent") remote.Parent = game.ReplicatedStorage remote.Name = "WeaponEvent" remote.OnServerEvent:Connect(function(plr) if famasClone.Parent ~= plr.Backpack then famasClone.Parent = plr.Backpack end if scarLClone.Parent ~= plr.Backpack then scarLClone.Parent = plr.Backpack end end)
This script would only clone once, and say a different player fires the event, the gun will be taken away from whoever has it. If this is the desired behaviour, keep it. If not, you should clone the weapon inside the event listener. Not outside of it.
remote.OnServerEvent:Connect(function(client) -- use a better parameter than plr. player is better too if not client.Backpack:FindFirstChild("FAMAS") and not client.Character:FindFirstChild("FAMAS") then famas:Clone().Parent = client.Backpack end if not client.Backpack:FindFirstChild("SCAR-L") and not client.Character:FindFirstChild("SCAR-L") then scarL:Clone().Parent = client.Backpack end end)
Notice the additional check on the character. When you equip a tool it is parented to your character. So they can't give themselves as many tools as they want.