Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Expected '=', got 'end' Error?

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

2 comments

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

0

If my Answer helped please upvote!

2 answers

✓ Accepted answer

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.

1 comment

2

Please do not give a user code without first explaining what you did/changed.

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.

4 comments

0

Please use the Comments.

0

Thank you so much! :D Sorry about not using the comments earlier. I'm new to Scripting Helpers.

0

You also fixed a bug in the starting screen! :D

0

what was it?

This discussion is preserved as it was. New answers, comments, and votes are closed.