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

Expected '=', got 'end' Error?

Asked by 9 years ago

I don't get what is causing this error. I'm new to scripting and only recently have started to get the hang of it. I get this error when attempting to write scripts a lot. It'd be nice if I knew in general what causes this error.

PLAY = script.Parent
PLAY.MouseButton1Down:connect(function() 
PLAY.Text = "ENJOY! :D" 

wait(0.1)

PLAY.Text = "You will spawn in 3 seconds..."

wait(3)

game.Players.Player.PlayerGui.ScreenGui:Remove()

wait(0.2)

game.StarterPlayer.CameraMode.LockFirstPerson

NOTE: "PLAY" is the name of my TextButton

0
I'm not entirely sure if it's just my browser not loading propperly or you havn't, But please do put your code in the code block... PredNova 130 — 9y
0
If my Answer helped please upvote! woodengop 1134 — 9y

2 answers

Log in to vote
-1
Answered by
woodengop 1134 Moderation Voter
9 years ago

Errors

In your script you made a function a Variable which won't work, you also added game.Players.Player.PlayerGui, player in this case, would be nil, because when you joined the server there would be no player so what would we do? We would use game.Players.LocalPlayer It finds the LocalPlayer which is you, But please note that LocalPlayer Only works in a LocalScript.

Perfections

local play=script.Parent
plr=game.Players.LocalPlayer
chr=plr.Character--the Character of the player(found in Workspace)
play.Text="HELLO"--Change
play.MouseButton1Down:connect(function()--functions don't make a good variable
    wait(.1)--or 0.1
    play.Text="You will respawn in 3 seconds"
    wait(3)
    plr.PlayerGui.ScreenGui:remove()--remove once clicked
    wait(.2)
    plr.CameraMaxZoomDistance=0.5
    plr.CameraMinZoomDistance=0.5
    chr.Humanoid.Died:connect(function()
        plr.CameraMaxZoomDistance=400
        plr.CameraMinZoomDistance=0.5
    end)
end)

Ok so what I've added here is your playgui/button, then the LocalPlayer that I was talking about earlier, as you can see I added plr.CameraMaxZoomDistance=0.5 instead of using game.StarterPlayer, its because StarterPlayer, sets it up before the player ever joins and when the server is running it can not be changed again(when on server). I added a chr.Humanoid.Died function so that it won't be in FPS mode when you respawn.

please note that this is in a LocalScript If there are any errors just Comment below.

2
Please do not give a user code without first explaining what you did/changed. Muoshuu 580 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I fixed that but the error is actually coming from the last end that it is requiring me to add.

Here is the new script:

PLAY = script.Parent

PLAY.MouseButton1Down:connect(function() PLAY.Text = "ENJOY! :D" -- end)

wait(0.1)

PLAY.Text = "You will spawn in 3 seconds..."

wait(3)

game.Players.Player.PlayerGui.ScreenGui:Remove()

wait(0.2)

game.StarterPlayer.CameraMode.LockFirstPerson

end

The error remained the same.

0
Please use the Comments. woodengop 1134 — 9y
0
Thank you so much! :D Sorry about not using the comments earlier. I'm new to Scripting Helpers. Qweeble 5 — 9y
0
You also fixed a bug in the starting screen! :D Qweeble 5 — 9y
0
what was it? woodengop 1134 — 9y

Answer this question