Dummies are not taking any dmg

I have an issue where, when I activate an ability it works fine and acts how I intended it to, but a dummy Ive placed down doesn’t take any dmg? I’ve un-anchored it and it seems to still not work

Script bellow is a script in serverscriptservice

Script bellow is in starter player scripts

image

firstly, please define Humanoid as local lol

secondly, not plr.Name will always return False, as plr.Name is a property which contains a string, and strings are truthy, so the not of a string would thus be False

what you should be doing is plr.Name ~= hit.Parent.Name, as that would check if the plr’s name is the same as the target’s name, rather than checking if the player has a name

I honestly dont know how i missed the local lol thanks alot

i really suggest you add a debounce on the server script, because exploits can easily trigger the remote event REALLY FAST ultimately either lagging your game or gaining unfair benefits.

How do i add a debounce? Also am I able to use stuff from one server script to another? for example if I create a leaderstats and coins value am I able to access those stats in another server script?

hmm. to answer the question with the debounce, i usually do something like this:

local counter = 0
local cooldown = 2
task.spawn(function()
    while task.wait(1) do counter -= 1/cooldown if counter < 0 then counter = 0 end end
end)

remoteevent.OnServerEvent:Connect(function()
    if counter > 0 then return end -- ends the function if the remote is being used too fast
    counter += 1 -- adds 1 to count how much times its being used
end)

well, you could get the leaderstats by just doing game.Players[idkputplayerreferencehere].leaderstats.
if youre not able to do that you could just use a bindableevent, it’s able to communicate between two serverscripts.

Thanks alot, ill try the debounce and bindable event.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.