Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sonic Styled Jump not working? No output or error..

so, i tried making a ball jump like in sonic games, everything is placed where it should be, but when the player jumps nothing happens, there's no output error or print,

local jumpin = script.Parent
local human = script.Parent.Parent.Humanoid

while true do
	wait()
	if human.Jumping == true then
			print("Jump")
			local transparencia = 1
			for k,v in pairs (jumpin:GetChildren())do
				if v:IsA("BasePart") then
				v.Transparency = transparencia
				script.Parent.Transparency = 0
				human.Parent.HumanoidRootPart.Transparency = 1
			end
		end
	end
	if human.Jumping == false then
			print("Floor")
			local transparencia = 0
			for k,v in pairs (jumpin:GetChildren())do
				if v:IsA("BasePart") then
				v.Transparency = transparencia
				script.Parent.Transparency = 1
				human.Parent.HumanoidRootPart.Transparency = 1		
			end
		end
	end
end

2 comments

0

Does it print "floor"?

0

I got you @EgoMoose

1 answer

✓ Accepted answer

###It is not working because of line 6. You're checking if an event equals true, which will not run because events don't equal true. You'll instead want to use the Jumping event over a loop.

local jumpin = script.Parent
local human = script.Parent.Parent.Humanoid

human.Jumping:Connect(function(active)
    wait()
    if active then -- if still active jumping 
            print("Jump")
            local transparencia = 1

            for k,v in pairs(jumpin:GetChildren())do
                if v:IsA("BasePart") then
                    v.Transparency = transparencia
                    script.Parent.Transparency = 0
                    human.Parent.HumanoidRootPart.Transparency = 1
                end
            end
        end

        if not active then
            print("Floor")
            local transparencia = 0

            for k,v in pairs(jumpin:GetChildren())do
                if v:IsA("BasePart") then
                    v.Transparency = transparencia
                    script.Parent.Transparency = 1
                    human.Parent.HumanoidRootPart.Transparency = 1      
            end
        end
    end
end)

1 comment

0

Thanks a lot!

This discussion is preserved as it was. New answers, comments, and votes are closed.