local Tool = script.Parent
local RemoteEvent = Tool:WaitForChild("RemoteEvent")
-- Client
Tool.Activated:Connect(function()
RemoteEvent:FireServer(true)
end)
Tool.Deactivated:Connect(function()
RemoteEvent:FireServer(false)
end)
-- Server
RemoteEvent.OnServerEvent:Connect(function(player, isActive)
while isActive do
print("Active")
wait(0.1)
end
-- runs loop again even though isActive is set to false
end)
This would be because the isActive that was sent through the remote event is what is being checked, as Firing a event does not update the last time the event was fired unless it is a variable outside of the function that is being changed.