My button don't come back after clicking

Hello, I try to make something like game paused feature. All works, when you click the Pause button your charcter stop moving and you have a little menu with a Play button. When I click Play I can move again but the Pause button don’t come back.

I m really bad at scripting so it maybe obvious why it don’t work so if some can fix my script :confused:

Here screenshotsof my explorer :

Here screenshot of the Play button :

Here the screenshot of the Pause button :

Thanks for helping :slight_smile:

try this

local frame = script.Parent.Parent.Frame
local open = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local RootPart = character:WaitForChild("HumanoidRootPart")

open.MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
    RootPart.Anchored = frame.Visible
end)

Do I put this in Pause button or Play button local script ?

--Pause button--
local frame = script.Parent.Parent.Frame
local close = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local RootPart = character:WaitForChild("HumanoidRootPart")
local open = player.PlayerGui.PauseGame.PauseButton

open.MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
    open.Visible = not frame.Visible
    RootPart.Anchored = frame.Visible
end)

--Play button--
local frame = script.Parent.Parent.Frame
local open = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local RootPart = character:WaitForChild("HumanoidRootPart")

open.MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
    open.Visible = not frame.Visible
    RootPart.Anchored = frame.Visible
end)

It don’t work, I can Pause but when I click on Play, nothing happening.

Is it possible to attach a video and a picture for the output?


I don’t know if you can see.

oh i see the issus

--Pause button--
local frame = script.Parent.Parent.Frame
local close = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local RootPart = character:WaitForChild("HumanoidRootPart")
local open = player.PlayerGui.PauseGame.PauseButton

close .MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
    open.Visible = not frame.Visible
    RootPart.Anchored = frame.Visible
end)

--Play button--
local frame = script.Parent.Parent.Frame
local open = script.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local RootPart = character:WaitForChild("HumanoidRootPart")

open.MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
    open.Visible = not frame.Visible
    RootPart.Anchored = frame.Visible
end)

It still same, I can Pause but I can’t click Play.

Put this script in StarterGui and remove your scripts

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local RootPart = character:WaitForChild("HumanoidRootPart")
local frame = player.PlayerGui.PauseGame.Frame
local PlayButton = player.PlayerGui.PauseGame.PlayButton
local PauseButton = player.PlayerGui.PauseGame.PauseButton

PlayButton.MouseButton1Click:Connect(function()
    frame.Visible = false
    PauseButton.Visible = true
    RootPart.Anchored = false
end)

PauseButton.MouseButton1Click:Connect(function()
    frame.Visible = true
    PauseButton.Visible = false
    RootPart.Anchored = true
end)

I used to have the same issue. I’m not sure if this would help you.
Try to change the “local open: game.StarterGui.PauseGame.PauseButton”
to “local open: script.Parent.Parent.Parent.PauseButton”

Again I’m not sure if this is going to help, But I used to have the same issue, and I fixed it by doing that.

1 Like