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

Why doesn't this display the players name when clicked? (SELF SOLVED)

Asked by 4 years ago
Edited 4 years ago

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.

0
You forgot the capitalize parent on the first line (not the answer) cmgtotalyawesome 1418 — 4y
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. cmgtotalyawesome 1418 — 4y
0
I've tried using localscript but the tweening flat out doesn't work. MustangHeart 67 — 4y
0
Like it literally wont even function, not printing things even outside of the function. MustangHeart 67 — 4y
0
Figured it out. Put it in starterplayerscripts and it worked. MustangHeart 67 — 4y

Answer this question