So I have this mouse detector script that will check if something is on or off, and its not working, any help? There aren’t any output errors.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local mouse = Player:GetMouse()
mouse.Button1Down:Connect(function()
if mouse.Target and game.Workspace.LittleFireSystem.FireAlarms.TurnedOn.Value == false and mouse.Target.Name == 'Body' and mouse.Target.Parent.Parent.Name == "FirePulls" and (Player.Character.HumanoidRootPart.Position - mouse.Hit.p).magnitude <= 10 then
if Player.Team == game.Teams.Teacher then
game.ReplicatedStorage.SchoolFire:FireServer()
end
else
if mouse.Target and game.Workspace.LittleFireSystem.FireAlarms.TurnedOn.Value == true and mouse.Target.Name == 'Body' and mouse.Target.Parent.Parent.Name == "FirePulls" and (Player.Character.HumanoidRootPart.Position - mouse.Hit.p).magnitude <= 10 then
if Player.Team == game.Teams.Teacher then
game.ReplicatedStorage.SchoolFireUndo:FireServer()
end
end
end
end)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local mouse = Player:GetMouse()
mouse.Button1Down:Connect(function()
if mouse.Target and mouse.Target.Name == 'Body' and mouse.Target.Parent.Parent.Name == "FirePulls" and (Player.Character.HumanoidRootPart.Position - mouse.Hit.p).magnitude <= 10 then -- This line should be used only once
if game.Workspace.LittleFireSystem.FireAlarms.TurnedOn.Value == false then -- Add this line
if Player.Team == game.Teams.Teacher then
game.ReplicatedStorage.SchoolFire:FireServer()
end
elseif game.Workspace.LittleFireSystem.FireAlarms.TurnedOn.Value == true then
if Player.Team == game.Teams.Teacher then
game.ReplicatedStorage.SchoolFireUndo:FireServer()
end
end
end
end)
You have everything else the same, just add that one line in