Hello! I'm trying to make a sonic game and I'm a bit stuck on making a ball appear when a character is jumping, I remember reading on the Dev Forum about how the humanoid has a property that detects what material the player is standing on, using this I tried to code a script that makes a ball appear when the character is in the air.
My script:
local Ball = script.Parent.Ball
if script.Parent.Humanoid.FloorMaterial == nil then
Ball.Transparency = 0
else
Ball.Transparency = 1
end
The script is a local script in StarterCharacter scripts and the ball wont apear (I have welded it to the Humanoid Root Part) and there are no errors in my output.
I have used a keybind to make it appear when you press space, however I find that this isn't what I was looking for because spamming space in the air would cause the ball to flash despite already being in the air.

1 comment
script.Parent.Humanoid.Changed:Connect(function() if script.Parent.Humanoid.Jump == true then (code here) end end)