How would I go about this spleef system?

I’m trying to make a spleef system but instead of just walking on the parts and unanchoring it, you have to jump on the parts to unanchor it. AND to add a bit of challenge, I want it so you can only unanchor a part when you was actually standing on it. What I mean is, you have to be on Part A, and then jump, and land on Part A to unanchor Part A. Being on Part A and then jumping, and landing on Part B, won’t do anything to Part B. I hope it makes sense.

Here’s my attempt so far… (I have this script in all the spleef parts)

local part = script.Parent

part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	local canSpleef = false
	
	if humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then
		if not canSpleef then
			canSpleef = not canSpleef
		end
	end
	
	if humanoid and canSpleef and humanoid:GetState() == Enum.HumanoidStateType.Freefall then
		part.Anchored = false
	end
end)

Example of a spleef system in case you don’t know:

Don’t do all that humanoid state an what ever just do.

Script.parent.touched:Connect(function()

–run code here when the player touches the block

end

Check to see if a part is touched, and record that the player has touched that part. Then check to see if the player is in the jumping state, if they are record that. When the player touches a part again, check to see if the part is the last part they touched, and if they jumped before touching again.

You can make a touch event on all the parts and then if the player presses space bar and the position is the same on the X or y axis then you should make the parts CanCollide false, you can make transparency false but this is just a basic way, others may give you a better way

Edit: here’s a better way

`local fall Part = game.Workspace.fallPart  - -or however you have it arranged
fallPart.Touched:Connect(function(hit)
--first check  if the player is in a jumping state   
--if its true then check if it touches that same part using another Touched event in this one
--then make it fall the way you want

Instead of just turning can collide off you can tween it down or lerp(linear interpolation) the way fall guys or stumble guys doit, I can help you with that if you want, also you could doit the way Minecraft do it by waiting for like 1/3 of a second then turning transparency to, with this make an if statement saying that if the falllPart.Transparency == 1 then the CanCollide is falso, you could make a boolean valuefor this also

I did this on mobile so sorry for grammar mistakes and also of edits

1 Like

People would say touched, but sadly I’m built different. :wink:

Personally i would do ray casting.


Assume the triangles are players, then you would cast a ray that ignored any parts associated with the player, simply destroy the part under them.

1 Like