Hello. I’m currently making an ability that stops time (or at least makes everyone stationary). I don’t know if this is the same as the actual ability, but I want the person who stopped time to be able to move. Its a simple adjustment that requires one if statement, but the if statement just doesn’t work. For some reason, the “if not otherPlayer == player” just makes it so that no one is affected by the time stop, and the print statement never runs. No errors appear in the output. abilities.ZaWarudo.OnServerEvent:Connect(function(player)
abilities.ZaWarudo:FireClient(player)
tweenService:Create(game.Lighting.ColorCorrection, tweenInfo, {Saturation = -1}):Play()
local sphereWave = script.SphereWave:Clone()
sphereWave.Parent = workspace
sphereWave.Position = player.Character:FindFirstChild("HumanoidRootPart").Position
tweenService:Create(sphereWave, tweenInfo, {Size = Vector3.new(200, 200, 200), Transparency = 0.25}):Play()
for _, otherPlayer in pairs(game.Players:GetChildren()) do
if not otherPlayer == player then
print("Someone has been time stopped")
RP.RemoteEvents.ChangeStatus:FireClient(otherPlayer, "Stun", 4.5)
end
end
(Not full script, but enough to showcase the problem)
Hmm, maybe try debugging by doing something like this:
for _, otherPlayer in pairs(game.Players:GetPlayers()) do -- use :GetPlayers() in case an object in Players exists that isn't a player.
if not tostring(otherPlayer) == tostring(player) then -- use tostring, just in case the player variable isn't a player for some reason
print("Someone has been time stopped")
print(tostring(otherPlayer)..' is not player.')
RP.RemoteEvents.ChangeStatus:FireClient(otherPlayer, "Stun", 4.5)
else
print('otherPlayer is '..tostring(otherPlayer) -- see if this outputs anything
end
end
Nothing is outputted. However, I did find a solution. Problem is that the not isn’t affecting the result of “otherPlayer == player” but instead affecting otherPlayer (I think.) I was using Python before Lua, so its weird for me.