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

GUI is not sliding in and out of screen?

Local script, when player hits a brick the GUI is supposed to slide into screen and stay for 3 seconds then slides back out. Not working for some reason. Script is in block and GUI is in StarterGUI

wait(1)

script.Parent.Touched:connect(function(part)
    if not part.Parent then return end
 
    local h = part.Parent:FindFirstChild("Humanoid")
    if not h then return end

	game.StarterGui.LElevator.Frame:TweenPosition(UDim2.new(.005,0,0,0), 'Out', 'Linear', .5 )
	
	wait(3)
	
	game.StarterGui.LElevator.Frame:TweenPosition(UDim2.new(-.005,0,0,0), 'Out', 'Linear', .5 )
end)

1 answer

✓ Accepted answer

You're trying to access the GUI directly from StarterGUI. StarterGUI automatically moves everything in it to the player in game.Players upon them entering the game. Access it from that location, as shown below. (Don't mind the semicolons at the end of each line... they act as periods in code and are optional in Lua.)

script.Parent.Touched:connect(function(part)
    local h = part.Parent;
    local player = game.Players:FindFirstChild(h.Name);

    player.PlayerGui.LElevator.Frame:TweenPosition(UDim2.new(0.005, 0, 0, 0), 'Out', 'Linear', 0.5);

    wait(3);

    player.PlayerGui.LElevator.Frame:TweenPosition(UDim2.new(-0.005, 0, 0, 0), 'Out', 'Linear', 0.5);
end)

If this does not work, please let me know. I'm just coming back to ROBLOX and working with Lua again so I'm a bit rusty. :)

3 comments

0

Still not working I dunno man

0

I'll work on this a bit for myself and see if I can get a working script. I'll message you on ROBLOX if you want when I'm finished. :)

0

alright thanks man, i appreciate it

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