Everything works except for when i hit play. I made it so theres a frame that covers the entire screen when you hit play, and after a while it fades out. But when I clone it from ReplicatedFirst into PlayerGui, it clones twice and theres two of “JoinFrame” in the PlayerGui. Here is the code:
local playerGui = game.Players.LocalPlayer.PlayerGui
local frame1 = game:GetService("ReplicatedFirst"):WaitForChild("JoinFrame"):Clone()
frame1.Parent = playerGui
local btn = script.Parent
local rem = game:GetService("ReplicatedStorage"):WaitForChild("CharAdd")
local gui = script.Parent.Parent.Parent
local startFrame = playerGui:WaitForChild("JoinFrame"):WaitForChild("Frame")
local tws = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local tweenFrame = tws:Create(startFrame, tweeninfo, {BackgroundTransparency = 1})
local playhit = script.Parent:WaitForChild("PlayHit")
local hover = script.Parent:WaitForChild("Hover")
btn.MouseButton1Click:Connect(function(plr)
playhit:Play()
rem:FireServer(plr)
frame1.Enabled = true
gui.Enabled = false
wait(5)
tweenFrame:Play()
gui:Destroy()
end)
btn.MouseEnter:Connect(function()
hover:Play()
end)
Try just parenting the GUI, there should be no need to clone it because youre only messing with the clients copy
This might eliminate the problem, but if not it narrows down the things it could be
Try disabling the play script then reEnable it when you put it as the playerGUI’s child because the script is probably running inside of ReplicatedFirst and then again when you clone it?