game.ReplicatedStorage.Event.TSDamage.OnInvoke = function()
if game.ReplicatedStorage.Event.InUse.Value == true then
for i, Humans in pairs (game.Workspace:GetChildren()) do
if Humans:FindFirstChild("Humanoid") then
hum = Humans:FindFirstChild("Humanoid")
oldhealth = hum.Health
oldmax = hum.MaxHealth
hum.MaxHealth = math.huge
hum.Health = math.huge
end
end
end
end
game.ReplicatedStorage.Event.AfterTS.OnInvoke = function()
if game.ReplicatedStorage.Event.InUse.Value == false then
for i, Humans in pairs (game.Workspace:GetChildren()) do
if Humans:FindFirstChild("Humanoid") then
hum = Humans:FindFirstChild("Humanoid")
hum.MaxHealth = oldmax
hum.Health = oldhealth
end
end
end
end
what this does is that when an event is fire, it basically remembers all the players' health and then sets their health to infinity. and then once the second health is fired, the players' health is reverted back to normal. whats happening here is that the first event is being repeated loads of times so that the script remembers the players infinite health instead of the original one so when the second event is fired, the players' health is still infinity and not reverted.
F key script
local input = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
input.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.F then
game.ReplicatedStorage.Event.TimeStopEvent:FireServer()
if game.ReplicatedStorage.Event.InUse.Value == false then
for i = 70, 200, 5 do
wait()
workspace.Camera.FieldOfView = i
end
for i = 200, 70, -5 do
wait()
workspace.Camera.FieldOfView = i
end
end
else
end
end)

9 comments
This has to do with the event being invoked i think, im not sure though
Hi, is this script a local or server script?
server script which is why it's invoked
Did you change the "InUse" value in a server script? That might be the problem
i changed it to yes when the first event is triggered and i changed it to no when the second event is triggered. i also removed the inuse from the code completely but it wasnt the problem as the problem still persisted.
Under what condition is the event triggered?
When i press the F key which is received by the server sided script. Then the server sided script triggers the event. I postted the server sided script on my other question.
Can you post your F key script here?
ok i edited the script