I thought a parameter inside of a MouseButton1Down event would return the player's name but it keeps outputting, Workspace.Terminal.Part.SurfaceGui.Frame.Start.Script:7: attempt to index local 'player' (a number value)

Can somebody help me out?

local t = script.parent.parent.Title
local s = script.Parent
s.MouseButton1Down:Connect(function(player)
	t:TweenPosition(UDim2.new(0.065,0,-0.6,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,1)
	s:TweenPosition(UDim2.new(0.065,0,2,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,1)
	wait (1.5)
	t.Text = "Welcome, ".. player.Name ..". Please enter your passcode:"
	t:TweenPosition(UDim2.new(0.065,0,0.15,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,1)

end)

Thanks!

Also, if I try switching it to a LocalScript, it flat out does nothing. Like the script literally won't even print something not even in the function and I don't know why.

5 comments

0

You forgot the capitalize parent on the first line (not the answer)

0

Also, if this is a GUI, you should be using a local script. If you are already using a local script (or you're switching) you can just use game.Players.LocalPlayer.Name for the text.

0

I've tried using localscript but the tweening flat out doesn't work.

0

Like it literally wont even function, not printing things even outside of the function.

0

Figured it out. Put it in starterplayerscripts and it worked.