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

Why won't this text rotate once a player joins?

Asked by 7 years ago
Edited 7 years ago

So I've tried to make a localscript which roates a TextLabel once a player joins. Here's the code.

game.Players.PlayerAdded:connect(function(player)
    while true do
    game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Rotation = 0
    wait(1)
    game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Rotation = 5
    wait(1)
    game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Rotation = -5
end
end)

Also the output is not showing any errors execpt a plugin error.

0
Have you tried it in Server-Test-Mode, rather than the Studio-Test mode? Async_io 908 — 7y
0
I'll try it now! wiktorwiktor12 0 — 7y
0
Still doesn't work. wiktorwiktor12 0 — 7y

1 answer

Log in to vote
0
Answered by
Async_io 908 Moderation Voter
7 years ago

Assuming this is in the StarterGUI, it would be better to use,

game.Players.PlayerAdded:connect(function() --Player argument isn't needed
    while true do
        for i = 0, 5, 0.1 do --I switched to for loops for a nicer movement. =)
.           wait(0.1)
            script.Parent.ScreenGui.TextLabel.Rotation = i --Since this is in the StarterGui, and assuming that the ScreenGui is in the StarterGui as well, you don't need to do all that other stuff.
        end
        wait(1)
        for i = 5, -5, -0.1 do
            wait(0.1)
            script.Parent.ScreenGui.TextLabel.Rotation = i
        end
        wait(1)
        for i = -5, 0, 0.1 do
            wait(0.1)
            script.Parent.ScreenGui.TextLabel.Rotation = i
        end
    end
end)

Hope this helps!

Ad

Answer this question