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

'for' initial value must be a number?

Asked by 5 years ago

So I have this local timer script which functions when server fires the client. The issue is that studio thinks that the 'for' in the script must be some number.

function getdata(Plr,Secs)
    for s = Secs,0,-1 do
        wait(1)
        script.Parent.Secs.Text = s
    end
end

game.ReplicatedStorage.Special.GiveTimer.OnClientEvent:Connect(getdata)
0
Please give me the full scripts to take a look. (all of them) User#22722 20 — 5y

1 answer

Log in to vote
0
Answered by
gullet 471 Moderation Voter
5 years ago
Edited 5 years ago

Yes it needs to be a number, you're using Secs a variable (that isn't a number). You need to set it to a starting value (number). You can use a variable but it needs to be a number as the error stated.

Update: I just noticed you have 2 arguments to the function, but OnClientEvent doesn't provide the player argument since it's the server firing and the clients player is localplayer. Just remove the Plr from function getdata(Plr,Secs) and it will probably work. If you're firing the event with a number that number will be in Plr and Secs will be nil.

0
At least show an example or the actual edited code for op. You're right, just show it. xPolarium 1388 — 5y
0
His code works as it is, he just needs to use a correct value as an argument when calling the function / firing the event. gullet 471 — 5y
Ad

Answer this question