Gui Tweened When Part Is Touched

Hello, I’m trying to make it so if you touch a part, a transition will appear with Tweens. I tried it with proximity prompt and it worked, but I can’t seem to find how to refer to PlayerGUI.
This is my current code

debounce = false
script.Parent.Touched:Connect(function(player)
	if not debounce then
	debounce = true
	script.Parent["Arena Enter - Clash Royale"]:Play()
	player.PlayerGui.Transisition.Frame:TweenPosition(UDim2.new(0, 0,0, 0),
		"Out",
		"Bounce",
		1,
		true)	
	wait(2)
	player.Character:MoveTo(script.Parent.Parent:FindFirstChild(tpname).Position)
	player.PlayerGui.Transisition.Frame:TweenPosition(UDim2.new(-1, 0,0, 0),
		"In",
		"Sine",
		1,
		true)
	debounce = false
	end
	end
end)

Is there anyway to fix this? (I’m not looking for any local scripts, since this is going to be copy pasted everywhere.)

1 Like

Hey yo make code eaiser to read put them inbetween two of these (```)

Ok I’ll see what I can do, ok?

2 things one local scripts dont work in work space and if it is a sever script you tween ui on the client and the .touched event doesn’t return a player it returns what it the part so you can just check if the hit part has a object in it parent called Humanoid then use the game.players:GetPlayerFromCharacter() function to get the player.

So like, get the humanoid first? I’m a bit confused on what your saying.

So for this I say to use a local script so you can actaully tween the Ui.

I am also no longer able to reply to your replys tonight for i am going to bed.

I’m trying to get the UI to tween without local script tho…

Thats impossible. That makes all player see it and once something is set in startergui you can no longer change it you can only do it via player gui and should be locally.

Use a remote event:
Server script in part with .Touched uses :FireClient and then in a local script you can use .OnClientEvent.