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

Attempt to call a string value

Asked by
TomsGames 225 Moderation Voter
10 years ago

It's in this script:

leader = game.Workspace:WaitForChild("LEADERBOARDS")
myname = leader:WaitForChild("5DistanceName")
myval = leader:WaitForChild("5Distance")

while wait(2) do
    script.Parent.Text = (tostring(myname.Value)" :: "..tostring(myval.Value)) -- ERROR HERE
end

The value of myval is a number, the value of myname is a string and if not then it is "-".

What is wrong?? I get this: attempt to call a string value

1 answer

Log in to vote
2
Answered by 10 years ago

On line six, you have a syntax error. You forgot to concatenate the string.

 script.Parent.Text = (tostring(myname.Value).." :: "..tostring(myval.Value)) -- ERROR HERE
0
Ah god I'm such a moron!!!! Thanks! TomsGames 225 — 10y
0
Jw, when is the next contest? TomsGames 225 — 10y
0
You mean Ludum Dare? HexC3D 830 — 10y
0
I disagree Kenetec, this is not a syntax error. The expression " print "Hello!" " is valid - it basically calls print with argument "Hello". This is also what happens here. However, what TomsGames is doing here is calling " :: " on the result of tostring - a string - and is thus "calling a string value". jobro13 980 — 10y
Ad

Answer this question