I have this script which is located under StarterPlayerScripts and it is a localscript, can anyone please help and add where I am supposed to write the 'if tool equipped' to proceed with the event. Thank you!
--< Services
local PlayerService = game:GetService('Players')
local UserInputService = game:GetService('UserInputService')
--< Variables
local Player = PlayerService.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local PlayerGui = Player:WaitForChild('PlayerGui')
local GameGui = PlayerGui:WaitForChild('GameGui')
local Text = GameGui.TextBox
local Activ = false
local Obj = nil
--< Events
UserInputService.InputBegan:Connect(function(Input)
if Activ and Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.E and Tool.Equipped:Connect then
Obj.Config.DetectEvent:FireServer()
end
end)
--< Loops
while wait() do
Obj = nil
Activ = false
Text.Visible = false
for _, Door in pairs(workspace.BasementDoor:GetChildren()) do
local mag = (Character.HumanoidRootPart.Position - Door.Center.Position).magnitude
if mag <= Door.Config.Range.Value then
Text.Visible = true
Activ = true
Obj = Door
end
end
end

1 comment
Still got no idea what to do...