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

argument 1 is missing or nil.....why should i add an argument ?

Asked by
hmurban 16
5 years ago

server-sided script in serverscriptservice.... this should fire the remote event when the numbervalue (points) is changed but it gives an "argument 1 is missing or nil" error in line 5

points = game:GetService("ServerStorage"):WaitForChild("points")
event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

points.Changed:Connect(function()
    event:FireClient()
end)

when it fires the event this local script should change the text of the text label to be = the value of the points

event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
points = game:GetService("ServerStorage"):WaitForChild("points")

event.OnClientEvent:Connect(function()
    script.Parent.TextLabel.Text = points.Value
end)

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

The problem is your server script.

The server need to know which client to fire the event to, so you'll need to add a client as an argument.

event:FireClient(game.Players.Doobb_yyus) -- example

If you don't have a specific player to fire it to and want to fire it to all clients, use FireAllClients.

event:FireAllClients()
0
ok thanks ^^ hmurban 16 — 5y
Ad

Answer this question