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

I can't re-enable the script any suggestions?

Asked by 3 years ago

So I have a part that enables a script and a GUI which disables the script. So if I touch the part(This enables the script) and after I disable the script(with the GUI) after I can't enable the script again with touching the part! The output doesn't give any error and I use server script for the part(that enables the script) and local script for the disable(GUI).

The disabler script(local script):

local LocalPlayer=game:GetService("Players").LocalPlayer
local Button = script.Parent
---------------------------------------------------------
Button.MouseButton1Click:Connect(function()
    print("Disabled!")
    LocalPlayer.PlayerGui:FindFirstChild("FurniturePicker").FurnitureList.PlacementHandler.Disabled = true
end)

The enabler script(server script):

local object = script.Parent

function onTouch(part) 
    local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
    if humanoid == nil and humanoid.Health <= 0 then return end
    local player = game.Players:GetPlayerFromCharacter(part.Parent)
    if player == nil then return end
    print("Enabled!")
    player.PlayerGui:FindFirstChild("FurniturePicker").FurnitureList.PlacementHandler.Disabled = false
end 

script.Parent.Touched:connect(onTouch)

0
You cannot access PlayerGui using a server-sided script. Use a **LocalScript** instead. Gmorcad12345 434 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

You cannot access PlayerGui using a server-sided script. Use a LocalScript instead.

1
While technically, you CAN access the PlayerGui from the server. You can't access guis in there unless they were cloned from the server; which unfortunately isn't how StarterGui clones them. radiant_Light203 1166 — 3y
0
the script works for the first time but if i want to re-enable it nothing happens (for the secodn time) 123balint1 -15 — 3y
Ad

Answer this question