Hello. In my game, I have a GUI. I want it to move into the screen after a player's respawn. I know how to move it in, using Udim2(0,0,0,0)) . So I have tried this by cloning a GUI from ReplicatedStorage and making the parent of the GUI as gui.Parent = plr.PlayerGui . However, I couldn't figure it out because I was using a local script, but I tried other things with other types of scripts in all sorts of locations but I couldn't get it to work.
So what I want to try and do now it I want the GUI out of the screen at (-1,0,0,0) so I set it to that in the properties window. But after a player respawns, I want the GUI to move in.
I can script the moving in, it's just that I want to learn how to make a script run every time a player respawns.
So here is the structure on how you play it.
-- You Join the game
-- You press "Play"
-- You then Press an Image button to join a team (the button has `:BreakJoints()` , so it kills and it also removes a GUI and makes another one's .Visible = false
--The Camera is "Scriptable" and the CFrame of the camera is a part which is looking at the player.
-- It's at this point that I want the GUI to roll in.
Can someone also tell me what scripts to put and where to put the them (i.e normal, in workspace)
So i tried this but it didnt seem to work.
local plr = game.Players.LocalPlayer
local frame = script.Parent
local team = game.Teams:WaitForChild("Noobs")
if plr.team == "Noobs" then
wait(1)
frame:TweenPosition(UDim2(0, 0,0, 0)) -- the current pos is on the left side of screen, unable to be seen
end
This script is in the frame that I want moving. It's a LocalScript .
I have another script, which is in the button you have to press to join the team.
local plr = game.Players.LocalPlayer --Easy way to refer to the client
local team = game.Teams.Noobs
if plr:FindFirstChild("HasSelectedTeam") then --Check for the value
script.Parent.Parent.Parent:Destroy() -- if the value is there, then destroy the frame
end
function onButtonClicked()
plr.Character:BreakJoints() --Easy way to kill people
plr.Team = team --The client's team has now been set to the team we made a variable of before
Instance.new("BoolValue",plr).Name = "HasSelectedTeam"; --create a value
script.Parent.Parent.Visibe = false --Instead of destroying it, it is set to invisible, because there are some valuable scripts inside
script.Parent.Parent.Parent.Options:Destroy() -- destroy the options, don't need them
end
script.Parent.MouseButton1Down:connect(onButtonClicked)
So that script above is in the Image button you press to join the team.
But I want to focus on the first script. Why does it not tween in my frame? I have set it so that it will run if the player is on the "Noobs" team. But it's either it doesn't tween or the script doesn't run.
Can someone help me out on this?

3 comments
plr.Team not plr.team
local team = game.Teams:WaitForChild("Noobs") if plr.Team == team then --idk end
and both scripts would be localscript i think