Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The script works only once it doesn't say anything in the console?

Asked by
bnxDJ 57
5 years ago

This is inside a ClickDetector and a normal script. It works only once and when I try to do this a second time it stops working. ~~lua script.Parent.MouseClick:Connect(function(plr)

if plr.PlayerGui:FindFirstChild("Dialog") == nil then

local gui = script.Parent.Dialog:Clone()

plr.Character.Humanoid.WalkSpeed = 0

gui.Parent = plr.PlayerGui

gui.Core.Disabled = false

script.Disabled = true

wait(1)

script.Disabled = false

end

end) ~~

0
Well, duh. Since Dialog is cloned into the PlayerGui, it is no longer nil and the function stops working because Dialog is already there. DeceptiveCaster 3761 — 5y
0
It doesn't work after the dialog has been deleted which is when it has been completed bnxDJ 57 — 5y

1 answer

Log in to vote
0
Answered by
sydre 229 Moderation Voter
5 years ago

Considering that you didn't delete the dialog from the script you inserted it in, you probably deleted the dialog in a local script. Whenever you do something in a local script, the server blocks that change and the change only happens for the player who activated the local script. In this case, you deleted the dialog in a local script which means that the server script can not see that the dialog is no longer in the player as the server blocket that change. To fix this, I would recommend you to instead use a local script to insert the dialog. This won't cause any problem as the walkspeed of a character is something that you can change from a local script as the server doesn't have to accept the change for it to work.

Ad

Answer this question