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

This script works in studio but not online?

Asked by 9 years ago
01local SetText = script.Parent.Text
02local player = game.Players.LocalPlayer
03local mouse = player:GetMouse()
04 
05function UpdateOldLabels(Parent)
06    for i,v in pairs(Parent:GetChildren()) do
07        if v.Name:sub(1,4):lower() == "line" then
08            local LineNumber = v.Name:sub(5)
09            if LineNumber == "12" then
10                v:Destroy()
11            else
12                v.Name = "line"..tostring(tonumber(LineNumber) + 1)
13                v.Position = v.Position - UDim2.new(0,0,0,15)
14            end
15        end
View all 62 lines...

1 answer

Log in to vote
0
Answered by
Bloxks 30
9 years ago

You need to use a LocalScript, which runs locally.

"LocalPlayer" directs a LocalScript to the Player object that the LocalScript is using, but a server script(Simply called, a "script".) cannot use it.

I may be wrong, but I've checked the script exactly five times, and there seems to be no problem if it's a LocalScript, and you said, "this script", so I'm guessing it's a script.

A better answer may be found here: http://wiki.roblox.com/index.php?title=LocalScript

0
I'm using a localscript. GullibleChapV2 155 — 9y
Ad

Answer this question