#Making an animation play when the player hit someone

73 messages · Page 1 of 1 (latest)

lost crypt
#

like as in touch or as in punch?

cobalt dew
#

punch

lost crypt
#

oh can u show me ur script?

cobalt dew
#

emmm

#

this script is to long for discord

#

you want it as a file?

lost crypt
#

sure

cobalt dew
#

ServerScriptService.UppercutServer:71: ServerScriptService.UppercutServer:9: attempt to index nil with 'Character'

#

also i got that error

#

dude

#

you can help me?

lost crypt
#

yea

cobalt dew
#

so

#

how i fix it?

lost crypt
#

is it in a local script?

cobalt dew
#

no

#

serverscriptservice

lost crypt
#

hmm

#

is the argument player nil?

cobalt dew
#

emm

#

wdym argument

lost crypt
#

like does ```rs.UppercutRemote.OnServerEvent:Connect(punch)

have a argument to pass to the function?
lost crypt
#

"player" is an argument

cobalt dew
#

oh

#

player should be the local player

lost crypt
#

oh

cobalt dew
#

maybe i need to make it the local player?

lost crypt
#

no no, since it needs the player argument

cobalt dew
#

yea

#

so

#

?

lost crypt
#

try to print "player"

cobalt dew
#

ok

lost crypt
#

if its nil then that might be the problem

cobalt dew
#

player is ni

#

nil

lost crypt
#

yup

cobalt dew
#

that what was printed

lost crypt
#

thats why, so try to do this:

rs.UppercutRemote.OnServerEvent:Connect(function(player)
    punch(player)
end)
cobalt dew
#

ok

lost crypt
#

change it to that

cobalt dew
#

ok

#

still same error

lost crypt
#

what line does the error occur?

cobalt dew
#

9

lost crypt
#

oh this:
local character2 = player.Character or player.CharacterAdded:Wait()

cobalt dew
#

yea

#

you found soultion?

lost crypt
#

might be bc player is nil

#

where does the function "hit" is called

cobalt dew
#

how we change the player from nil

#

emm

#

if (char.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude <= punchDistance then
coroutine.wrap(hit)(char, punchDamage)

            break
        end
#

line 62

lost crypt
#

ohhh

#

coroutine.wrap(hit)(char, punchDamage) in this part change it to this:

)```
cobalt dew
#

again

#

error hasent changed

lost crypt
#

and here too

#

for _, dummy in workspace.Dummies:GetChildren() do
if (dummy.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude <= punchDistance then
coroutine.wrap(hit)(dummy, punchDamage)
break
end
end

cobalt dew
#

ok

#

working

#

thanks blud

lost crypt
#

np

#

sorry if i waste your time earlier

#

Have a great day!

cobalt dew
#

you didnt waste my time

#

thank you

cobalt dew
#

@lost crypt