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

Unable to make this script work in localscript?

Asked by
Nosteal 50
8 years ago

I've been trying to find out why this script that i made only works in "Script", but not in "LocalScript" Here's the code in case you were wondering.

wait(5)
function PlayerAdded(PlayerAdded)
    m = Instance.new("Message")
    h = Instance.new("Hint")
    h.Parent = game.Workspace
    h.Name = "gtfo"
    h.Text = "Hello, friend."
    wait(4)
    h.Text = "We haven't seen each other for a while, ".. game.Players.LocalPlayer.Name .."."
    wait(10)
    h.Text = "You might remember me as Z'Ralk'Thalat."
    wait(5)
    h.Text = "B U T"
    wait(2)
    h.Text = "T H A T"
    wait(2)
    h.Text = "I S"
    wait(2)
    h.Text = "N O T"
    wait(2)
    h.Text = "M Y"
    wait(2)
    h.Text = "N A M E"
    wait(1)
    game.Workspace.gtfo:remove()
    m.Parent = game.Workspace
    m.Text = "Loading [QWRTB()T]"
    wait(5)
    m.Text = "Loaded!"
    wait(2)
    game.Workspace.Message:remove()
    S = game.Workspace:FindFirstChild("Humanoid",true)
    if S then
    S.Health = 0
end
    h.Parent = game.Workspace
    h.Text = "[QWRTB()T] PERMISSIONS LEVEL: 9"
    wait(3)
    h.Text = "[QWRTB()T]: AbFGrNy has requested to ban ".. game.Players.LocalPlayer.Name .."."
    wait(5)
    h.Text = "There are ".. game.Workspace.Votes.Value .." Votes."
    for i = 0, 19 do
        wait(0.5)
        game.Workspace.Votes.Value = game.Workspace.Votes.Value + 1
        h.Text = "[QWRTB()T]: There are ".. game.Workspace.Votes.Value .." Votes."
    end
    wait(1)
    S:remove()
    wait(1)
    h.Text = "[QWRTB()T]: ".. game.Players.LocalPlayer.Name .." Has been banned."
    game.Players.LocalPlayer:remove()
end

game.Players.PlayerAdded:connect(PlayerAdded)

1 answer

Log in to vote
0
Answered by 8 years ago

I'm not an expert in lua but I think it's because a localscript is when it uses the user's pc to execute something(ex.) user input) and the "normal" script is executing the code on the server which is what your code is doing by just displaying messages and hints.

Ad

Answer this question