I have made the script but it seems to not want to work, is it that I added the CoreGUI part in the script that broke it? idk im trying to figure this out
local StarterGui = game:GetService("StarterGui")
script.Parent.Touched:Connect(function(SafeZone)
if(SafeZone.Name ~= "HumanoidrootPart") then return end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
local character = SafeZone.Parent
local forceField = Instance.new("ForceField")
forceField.Visible = false
forceField.Name = "safezone"
forceField.Parent = character
end)
script.Parent.TouchEnded:Connect(function(SafeZone)
if(SafeZone.Name ~= "HumanoidrootPart") then return end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
local character = SafeZone.Parent
local forceField = character:FindFirstChild("SafeZone")
if(forceField) then
forceField:Destroy()
end
end)
Yes, it has to be local. More specifically, StarterGui:SetCoreGuiEnabled() only works locally. Surprised you didn’t get any errors about this, because when I tried it on the server, it gave me an error.
Anyways, you can try to use a remote event to tell a LocalScript to enable/disable the backpack.
Sorry, I don’t think I understand. Can you elaborate more on your statement? What do you mean by “Unusable”? Like the script still doesn’t work, or it doesn’t fit your needs, or something else.
I just tested it, and it worked like you wanted it to (based off of your code on your original post). I codded it so when the player touched a specific part, it gives the player a ForceField on the server, while disabling the backpack on the client. When the player stopped touching a specific part, the ForceField is removed, and the backpack is enabled again.
Can you please elaborate on “unusable” for your scenario, as it worked for me when I tested it.
(I can send the scripts I used to test if it helps!)