#I wanna know if this script works

1 messages · Page 1 of 1 (latest)

coral pilot
#

So I just started scripting yesterday so fix me if there's a bug (trying to make a player super jump by touching a block)

Local jump brick = script.parent

jump brick.Touched:Connected(function(hit)
Local character=hit.parent
Local humanoid=character.FindFirstChild("Humanoid")
If humanoid then
Humanoid.JumpPower=150
End
End)

brittle elm
smoky cape
#

End .. Local .. local jump brick ... jump brick.Touched

coral pilot
#

So like

local jumpbrick = script.parent

jumpbrick.Touched:Connected(function(hit)
local character=hit.parent
local humanoid=character.FindFirstChild("Humanoid")
If humanoid then
Humanoid.JumpPower=150
End
End)

rose sapphire
#

yea like dat

#

and you wrote Humanoid

#

not "humanoid"

brittle elm
#
  • waht ve said
coral pilot
rose sapphire
#

Humanoid.JumpPower=150

brittle elm
#

and character:FindFirstChild instead of character.FindFirstChild (. -> :)

coral pilot
#

Oh ye

rose sapphire
#

u define character.FindFirstChild("Humanoid") as humanoid

brittle elm
coral pilot
#

A lot of mistakes

brittle elm
# coral pilot What

FindFirstChild is a method, you need to call it with the : character instead of the . character

coral pilot
#

Oh yea

#

I'll try to fix it

#

local jumpbrick = script.Parent

jumpbrick.Touched:Connected(function(hit)
local character=hit.Parent
local humanoid=character:FindFirstChild("Humanoid")
If humanoid then
humanoid.JumpPower=150
end
end)

deft cryptBOT
#

studio** You are now Level 1! **studio

coral pilot
#

Is that ok?

brittle elm
#

I think thats good

#

oop wait no

#

if has a lowercase i, not capital

coral pilot
#

Oh oh oh mb

#

local jumpbrick = script.Parent

jumpbrick.Touched:Connected(function(hit)
local character=hit.Parent
local humanoid=character:FindFirstChild("Humanoid")
if humanoid then
humanoid.JumpPower=150
end
end)

brittle elm
#

I think thats right, final thing would be some formatting to make the code easier to read and debug.

local jumpbrick = script.Parent

jumpbrick.Touched:Connected(function(hit)
  local character = hit.Parent
  local humanoid = character:FindFirstChild("Humanoid")
  if humanoid then
    humanoid.JumpPower = 150
  end
end)
  • Spaces around equals
  • Indent code thats inside a block