So I am trying to make a Fire System to where if you walk into the fire your health gets slowly subtracted only when inside the fire area, therefore when you walk out of the fire it stops taking damage.
I’ve followed a tutorial on Sound Regions and tried to edit it but it failed.
You can’t be changing your health in a LocalScript… I mean you can but it won’t replicate to the server, and if your health is 0 on the client, your character will probably just die.
Yeah I agree with you, just trying to inform him that something did show in the output. Didn’t think repeating what was already said would be helpful haha
@Nasher986 Put this in a server-sided script. Preferably, I would place it in ServerScriptService.
local FireRegionsWorkspace = game.Workspace:WaitForChild("FireRegions")
local function getCharacters()
local list = {}
for _,plr: (Player) in pairs(game.Players:GetPlayers()) do
if plr.Character then
table.insert(list,plr.Character)
end
end
return list
end
while task.wait(1) do
local damagedPlayers = {}
for i,v in pairs(FireRegionsWorkspace:GetChildren()) do
local firePart = v.FirePart
local region = Region3.new(firePart.Position - (firePart.Size/2),firePart.Position + (firePart.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, getCharacters())
for _, part in pairs(parts) do
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player and table.find(damagedPlayers,player) == nil then
if firePart.ParticleEmitter.Enabled == true then
table.insert(damagedPlayers,player)
local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
end
end
end
end
end
end
It does change on the client, but doesn’t replicate to the server, and unlike walkspeed or jumppower they do not affect the character in any way. If it did, the exploiters can become god via