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)
You cannot access PlayerGui using a server-sided script. Use a LocalScript instead.