What I want is when the player touches the part, the ScreenGui clones in the player's PlayerGui. When the ScreenGui is in the PlayerGui it Tweens to a certain position. (Only one ScreenGui can appear though), this is my code:
local s = script.Parent
s.Touched:connect(function(part)
local human = part.Parent:findFirstChild("Humanoid")
if human then
local player = game.Players:GetPlayerFromCharacter(human.Parent)
if player then -- player touched part
script.Parent.RemoteEvent:FireClient(player)
local PlayerGui = game.Players.LocalPlayer.PlayerGui
local Gui = game.ReplicatedStorage:FindFirstChild("KeyController")
Gui:Clone().Parent = PlayerGui
end
end
end)
The problem is when I step on the part and move a little - so many ScreenGui's are cloning into my PlayerGui. I don't want that, I only want one to display.
Also, this is my movement script (TweenPosition):
local s = script.Parent
local PlayerGui = game.Players.LocalPlayer.PlayerGui
function Tween()
s:TweenPosition(UDim2.new(1,0,0,0), "Out", "Quad", 3, false)
end
if s.Parent.Parent == PlayerGui then
Tween()
end

1 comment
Works pretty well. Thanks.