Hey.
I am currently making a script that gives a tool to a player if they are within my union, but I am confused on how to give the player the tool if they are on a specific team, then disabling it if they exit.
Here is the script I started working on:
local WS = game:GetService("Workspace")
local RS = game:GetService("ReplicatedStorage")
local ZoneModule = require(script:WaitForChild("Zone")) -- requires the zone module
local union = WS:WaitForChild("Map"):WaitForChild("Union")
local zone = ZoneModule.new(union)
local team = game:GetService("Teams"):WaitForChild("GKH")
local tool = RS:WaitForChild("GK")
zone.playerEntered:Connect(function()
print("Entered the zone.")
end)
zone.playerExited:Connect(function(player)
print("Exited the zone")
end)
Link to ZonePlus:
ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries - Community Resources - DevForum | Roblox
Update: made a really messy scripts, prints disabled but not enabled…
local RS = game:GetService("ReplicatedStorage")
local val = RS:WaitForChild("GKValue")
local eventEnabled = RS:WaitForChild("EnableGK")
local eventDisabled = RS:WaitForChild("DisableGK")
local tool = script.Parent
local F = tool:WaitForChild("F")
local C = tool:WaitForChild("C")
local E = tool:WaitForChild("E")
local H = tool:WaitForChild("H")
local Q = tool:WaitForChild("Q")
local R = tool:WaitForChild("R")
local T = tool:WaitForChild("T")
local V = tool:WaitForChild("V")
local Z = tool:WaitForChild("Z")
local FClone = RS:WaitForChild("F")
local CClone = RS:WaitForChild("C")
local EClone = RS:WaitForChild("E")
local HClone = RS:WaitForChild("H")
local QClone = RS:WaitForChild("Q")
local RClone = RS:WaitForChild("R")
local TClone = RS:WaitForChild("T")
local VClone = RS:WaitForChild("V")
local ZClone = RS:WaitForChild("Z")
eventDisabled.OnClientEvent:Connect(function()
if F == true then F:Destroy() end
if C == true then C:Destroy() end
if E == true then E:Destroy() end
if H == true then H:Destroy() end
if Q == true then Q:Destroy() end
if R == true then R:Destroy() end
if T == true then T:Destroy() end
if V == true then V:Destroy() end
if Z == true then Z:Destroy() end
print("Sucsess, destroyed!")
eventEnabled.OnClientEvent:Connect(function()
if F == false then FClone:Clone().Parent = tool
if C == false then CClone:Clone().Parent = tool
if E == false then EClone:Clone().Parent = tool
if H == false then CClone:Clone().Parent = tool
if Q == false then QClone:Clone().Parent = tool
if R == false then RClone:Clone().Parent = tool
if T == false then TClone:Clone().Parent = tool
if V == false then VClone:Clone().Parent = tool
if Z == false then ZClone:Clone().Parent = tool
print("Sucsess, cloned!")
end
end
end
end
end
end
end
end
end
end)
end)
Any help appriciated