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 10 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.

01PLAY = script.Parent
02PLAY.MouseButton1Down:connect(function()
03PLAY.Text = "ENJOY! :D"
04 
05wait(0.1)
06 
07PLAY.Text = "You will spawn in 3 seconds..."
08 
09wait(3)
10 
11game.Players.Player.PlayerGui.ScreenGui:Remove()
12 
13wait(0.2)
14 
15game.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 — 10y
0
If my Answer helped please upvote! woodengop 1134 — 10y

2 answers

Log in to vote
-1
Answered by
woodengop 1134 Moderation Voter
10 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

01local play=script.Parent
02plr=game.Players.LocalPlayer
03chr=plr.Character--the Character of the player(found in Workspace)
04play.Text="HELLO"--Change
05play.MouseButton1Down:connect(function()--functions don't make a good variable
06    wait(.1)--or 0.1
07    play.Text="You will respawn in 3 seconds"
08    wait(3)
09    plr.PlayerGui.ScreenGui:remove()--remove once clicked
10    wait(.2)
11    plr.CameraMaxZoomDistance=0.5
12    plr.CameraMinZoomDistance=0.5
13    chr.Humanoid.Died:connect(function()
14        plr.CameraMaxZoomDistance=400
15        plr.CameraMinZoomDistance=0.5
16    end)
17end)

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 — 10y
Ad
Log in to vote
0
Answered by 10 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 — 10y
0
Thank you so much! :D Sorry about not using the comments earlier. I'm new to Scripting Helpers. Qweeble 5 — 10y
0
You also fixed a bug in the starting screen! :D Qweeble 5 — 10y
0
what was it? woodengop 1134 — 10y

Answer this question