I need some help making a Damage Over Time script

So, I made a fire damage script that gets cloned into game.Players.theHitPlayer when a player gets hit by a fire weapon.

I’m parenting the script in the Player instance because players have network ownership over their character models, so exploiters could delete the fire damage script from their character.

The problem I am facing is that I am unsure how to properly locate the Player’s Humanoid Object from the Player’s Instance.

Here’s what I tried

local Humanoid = script.Parent.Character.Humanoid

while true do

Well is there any errors? I don’t see why this wouldn’t work

Edit: nvm i see it now Scripts that are parented directly to the player will not run they seem to just delete themselves

Maybe use a wait for child or find first child

Interesting, does the script get disabled if it were parented to a child of the Player? Like PlayerScripts?



It needs to reference the character

Well player scripts can only run local scripts(Dont quote me on this)
and as @DisguisedTimmy said try using a waitforchild if your weapon parents the script to the player it will run(i thought it was there from the start lol)

first of all, did you parent the script to the player, and also don’t use a localscript to damage players because the other clients won’t see it, I made damage over time system a while ago, it’s to make use of os.time() and checking if the time is greater than the time the fire is gonna be for, something like this

-- Keep in mind, never change humanoid properties or any properties on the client unless you want the stats locally
-- So this should be a serverscript, this is just a part of the script, so localplayer won't work

local lastDamage = os.time()
local fireTime = 5
local damage = 10 -- I made a modular system but here you can have a variable

while (os.time() - lastDamage) < fireTime do
    lastDamage = os.time()

Ok let clarify a bit. The DOT script already works if I were to parent it to the Player’s Character and just do local humanoid = Script.Parent.Humanoid. Then humanoid:TakeDamage(x)

The problem is Exploiters have network ownership over their characters and can delete the script from their character, so I am trying to avoid parenting the damage script to their characters.

So I am trying to parent the script to their Player object in image

Unfortunately for some reason, when I clone the script and parent it to the Player Object, it seems the script doesn’t run. Sorry for not being more specific.

local c = game.Players.LocalPlayer.Character
local hum = c:WaitForChild("Humanoid")

you just forgot to get the character model in the workspace. :sweat_smile:

also don’t damage the player on the client, that’s what im trying to say

im sorry but who parent’s a script to the player expecting an exploiter not to delete it, if exploiters can change scripts in playerScripts, why can’t they delete a script inside their own player

I am not changing anything on the Client. Everything is being done on the server.

Players have ownership over their actual character models within the workspace. Allowing them to delete parts from their model and it will actually replicate onto the server.

PlayerScripts can only run LocalScripts. Regardless, the server cant even access the playerscripts folder. You can however put the script in PlayerGui. It will run and I don’t think the player has network ownership of it. Is there any reason you don’t handle the DOT in a bindable event though?

This should be placed in a normal script inside ServerScriptService or ServerStorage where clients have no access to hence cannot delete, see or interact with it.

That looks like a local script because server scripts are not stored in Players so change it to a server script.