script.Parent.Heal.OnServerEvent:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local humrp = char:FindFirstChild("HumanoidRootPart")
local humanoid = char:FindFirstChild("Humanoid")
local particles = script.ParticleEmitter:Clone()
particles.Parent = humrp
particles:Emit(25)
humanoid.Health += 25
end)
If anyone has a good way of explaining ‘example’ is not a valid member of ‘example’
I’d love to hear! I had the same situation a few days back but couldn’t understand how to fix it this time.
I was thinking this too … Also assert will throw an error it not true.
So, @Duck keep in mind this is a diagnostic call. If that works you may not want to include that line.
Ah, so your tool is missing the RemoteEvent named Heal. If you insert it and name it exactly that, it would retain its original function. It should be directly under Hotdog, not any of its descendants.
Im pretty sure you blindly copied code from someone. Putting a remote event in a tool overal, is not the smartest thing to do. And you don’t even got it in your tool
Depends on how you look at it. I followed a tutorial on how to do it because I’ve only been coding for around 2 months and still am learning. I thought I said that in the original post.
like someone said in my post, this is why you dont follow full tutorials, but learn how to script instead. if you dont know what youre doing then theres little to no chance of finding out what you did wrong.
There’s nothing wrong with watching tutorials at the start, that’s how you learn. eventually you should 100% branch off and do things independently, but that’s hard for a complete beginner. It’s hard to go off on your own when you can’t even walk.
So I finally figured this out, I decided to use the game Scripting School for some help on things I didn’t understand, Followed a tutorial and read some forum posts and I have this to heal the player:
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild("Humanoid")
humanoid.Health = humanoid.Health + 25
end)
So according to my non-existent coding knowledge that should be all you need to make a basic heal tool.