Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I'm haveing issues with a script no errors or anything?

So the problems with this script are that it does not destroy itself and when the script tells it to close a gui it does not close. No errors. Please provide me with a script that fixes this, thanks.

Here is the script:

local Clicks = 3
local Confirm = game.StarterGui.Confirm
script.Parent.MouseClick:connect(function(player)
	Clicks = Clicks +1
	game.Players.LocalPlayer.leaderstats.Trash.Value = game.Players.LocalPlayer.leaderstats.Trash.Value +25
	Confirm.Parent = player.PlayerGui
		script.Parent.Parent.Sound:Play()
Confirm.Enabled = true
if(Clicks < 3) then
game.Workspace.P2:Destroy()
wait(.5)
Confirm.Enabled = false
	end
	end)

2 comments

0

i didnt read the whole script but definitely do this game.Workspace["P2"]:Destroy()

0

That won't work.

1 answer

✓ Accepted answer

Hello there,

I have fixed your script according to my knowledge, if there is something wrong with it, explain what happened in the comments, or in the community chat, here is the script:

game:GetService('Players').PlayerAdded:Connect(function(Player)
local Clicks = 3
local Confirm = game.StarterGui.Confirm

script.Parent.MouseClick:Connect(function()
    Clicks = Clicks +1
    Player.leaderstats.Trash.Value = Player.leaderstats.Trash.Value + 25
    Confirm.Parent = Player.PlayerGui
    script.Parent.Parent.Sound:Play()

    Confirm.Enabled = true

    if(Clicks > 3) then
        game:GetService('Workspace'):FindFirstChild("P2"):Remove()
        wait(.5)
        Confirm.Enabled = false
    end
end)
end)

MAKE SURE THIS IS A REGULAR SCRIPT!

I hope I helped,

~Frag

This discussion is preserved as it was. New answers, comments, and votes are closed.