Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come this script for a water blast isn't detecting players?

Asked by 5 years ago

I was scripting a small wave that comes out of the players hand, but the actual wave doesn't detect when it hits a player, though I used the get player service and touched connect.

local Water = script.Parent


 local function hurt(other)
    local parent = other.Parent
    if game.Players:GetPlayerFromCharacter(parent) then
     parent.Humanoid.WalkSpeed = 10
    wait(.8)
    parent.Humanoid.WalkSpeed = 16
    wait(.8)
    Water:Destroy()
end

Water.Touched:Connect(hurt)

end

Anyone know what's wrong?

0
Im not so sure cause im new but i think instead of hurt it should mean something that kills the player or takes out health points?? pr3cure -26 — 5y
0
oh yeah fighterkirbyzx 102 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Ok i dont know what you want or wher this is, but hers what i would do: (normalscript)

Water.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") then
--i do hit.parent.parent in case it is a hat thats touched, or if hats dont count then take it out
hit.Parent.Humanoid.WalkSpeed = 10
end
end)

and omg what is up with your code!? I understand but still im looking at it like https://youtu.be/ua-3T12Um7U?t=349 I mean, You do NOT need getplayerfromchracter player from other.parent and that stuff!

0
oh, well, thanks! Ill see if it works fighterkirbyzx 102 — 5y
0
and sorry for my code being a mess of me trying to mix my code and a youtubers, i just now realized how much more simpler i can code things. fighterkirbyzx 102 — 5y
Ad

Answer this question