I did a script that is supposed to disable the other 2 local scripts and set the parent of a tool when a part is touched. The script:
local portalGun = workspace.World.NotPlaceable.PortalGun
local realTool = game.ServerStorage:WaitForChild("PortalGun")
local function onTouch(part)
local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if humanoid == nil then return end
script.Parent.ActivatePortals.Disabled = false
realTool.Parent = script.Parent
portalGun:Destroy()
script.Parent.FirstPersonArms.Disabled = false
end
portalGun.Touched:Connect(onTouch)
The only part that works is destroying that gun.
This is the explorer:
No errors or something in output.
local ScriptService = game:GetService("ServerScriptService")
local event = ScriptService:WaitForChild("Event")
local portalGun = workspace.World.NotPlaceable.PortalGun
local realTool = game.ServerStorage:WaitForChild("PortalGun")
local function gotGun()
script.Parent.ActivatePortals.Disabled = false
realTool.Parent = script.Parent
portalGun:Destroy()
script.Parent.FirstPersonArms.Disabled = false
end
event.Event:Connect(gotGun)
local function onTouch(part)
local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if humanoid == nil then return end
event:Fire()
end
You have script A who enables the event. In script A you put:
Eventname:Fire()
You have script B who runs the event. In script B you put:
Eventname.Event:Connect(function()
–anything you want to happen, put it here.
end)
Dont’ forget to add a Bindable Event in the explorer, or create on with Instance.new()
NOTE: The name of the Bindable Event must me “Eventname” which you also use in the Eventname:Fire / Eventname.Event:Connect