I’m attempting to make this script activate another script when this tool is enabled but for some reason it won’t work. I’ve looked at my previous working scripts and all over the dev forums just for some reason it won’t work.
local script = script.Parent.Handle.GloveScript
local tool = script.Parent
tool.Activated:Connect(function()
script.Enabled = true
task.wait(0.5)
script.Enabled = false
end)
The “script” global is shadowed by your local variable in the first line which points to the script you want to be toggling. The second line uses that reference instead of the current script so the “tool” variable is now set to the handle. Instead of “script” try “gloveScript” as the name. The tool variable should still use the “script” global.
In the studio script editor, you can see globals like script get colored differently. Unless you know what you’re doing shadowing a variable, you can lose track of where it’s pointing.