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

My output says Argument 1 missing or nil from a remoteevent , help?

Asked by
bailley5 114
3 years ago

so I am trying to make it so when a player clicks it adds a value to leaderstats, I am using a RemoteEvent on line 16 to connect with the server, The error also comes from the remote event.


local Tool = script.Parent; local Player = game.Players.LocalPlayer enabled = true function onActivated() if not enabled then return end enabled = false game.ReplicatedStorage.Click:FireClient() wait(.3) Tool.GripForward = Vector3.new(-0.976,0,-0.217) Tool.GripPos = Vector3.new(.95,-0.76,1.4) Tool.GripRight = Vector3.new(0.217,0, 0.976) Tool.GripUp = Vector3.new(0,1,0) Tool.Handle.DrinkSound:Play() wait(.8) local h = Tool.Parent:FindFirstChild("Humanoid") if (h ~= nil) then if (h.MaxHealth > h.Health + 1.6) then h.Health = h.Health + 1.6 else h.Health = h.MaxHealth end end Tool.GripForward = Vector3.new(-0.976,0,-0.217) Tool.GripPos = Vector3.new(0.3,0,0) Tool.GripRight = Vector3.new(0.217,0,-0.976) Tool.GripUp = Vector3.new(0,1,0) wait(3) enabled = true end function onEquipped() Tool.Handle.OpenSound:play() end script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped)
0
i meant line 15, sorry! bailley5 114 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You have to direct the event to a certain player, in this case, the local player. Idk if the local player works on a script. Unless you use FireAllClients() it will error. Write a player in for argument 1.

Note: FireAllClients is not what you need.

Ad
Log in to vote
0
Answered by 3 years ago

You need the player as a first argument for :FireClient to work. Try using :GetPlayerFromCharacter.

Answer this question