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
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 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.