The jumping platform script does not work

robloxapp-20201021-0902545.wmv (294.4 KB)

robloxapp-20201021-0903249.wmv (106.9 KB)

Someone could help me to improve my model it agrees with other scripts that I found in the toolbox but it has errors

3 Likes

spring_ = script.Parent.Parent.Spring_

spring_ = script.Parent.Parent.Spring

DB = false

function onTouch()

if DB == false then

DB = true

spring_.CFrame = spring_.CFrame*CFrame.new(0, -0.5, 0)

script.Parent.s1:Play()

wait(0.10)

DB = false

spring_.CFrame = spring_.CFrame*CFrame.new(0, 0.5, 0)

end

end

script.Parent.Touched:connect(onTouch)

wait()

v3 = Vector3
v2 = nil

function wt() wait() end – Smooth

load = 0

repeat wt’’ load = load + 1 until load < 2
load = load + 4

velo = 20
s_ = v3.new(script.Parent.Size.x, script.Parent.Size.y, script.Parent.Size.z)
scale = 4

function_ = true

print(v3, 'load: '…load, ‘’)

– Function (where the magic happens)

function v(f)

v = f.Parent:FindFirstChild'Humanoid'

if (load > 2 and ( (v ~= nil) or (v.Health > 0) ) and function_ == true) and scale > 0 then -- Check if the player and everything else are okay
	
	script.Parent.p1.Enabled, script.Parent.p2.Enabled = true, true
	
	
	v2 = Vector3.new(0, (0 + ((scale - v.Parent.HumanoidRootPart.Velocity.Y) * velo)) - 0, 0) -- Set the Part Velocity
	
	script.Parent.Velocity = v2
	v.JumpPower = (0 + ((scale - v.Parent.HumanoidRootPart.Velocity.Y) * velo)) - 0 -- Set player's jump-power
	
	script.Parent.Velocity = v3.new(0, 0, 0)
	
	v.Jump = true
	script.Parent.Size = v3.new(scale / 2, script.Parent.Size.y/2, scale / 2)
	
	script.Parent:FindFirstChild's1':Play()
	for j = (scale / 2), scale do wait(.05) script.Parent.Size = v3.new(j, j-1, j) end -- Spring animation
	script.Parent.Size = v3.new(scale, 2, scale)
	
	--Reset everything
	script.Parent.p1.Enabled, script.Parent.p2.Enabled = false, false
	script.Parent.Velocity = Vector3.new(0, 0, 0)
	v.JumpPower = 50
	v2 = nil
end

end

script.Parent.Touched:connect(v)

– the end

I just need that the jumps are not so high just light

Can you format all the code in a single post using three backticks ``` at the start and the end?

It’s very difficult to read when some is formatted and some isn’t across multiple posts.

If possible also describe the behaviour for those on non-Windows devices as wmv files are a Windows format.

1 Like

Do you want me to give you a model for you to review?

The title and description could have been a bit more informative but most importantly there is a lack of code. Also, #help-and-feedback:code-review is for fixing/upgrading already working code and this post should be in #help-and-feedback:scripting-support. So, for anyone else here I took the model. Below is an image of the model hierarchy and the code of both scripts.

image

Script: "SpringScript"
spring_ = script.Parent.Parent.Spring_
spring_ = script.Parent.Parent.Spring
DB = false

function onTouch()
	if DB == false then
	DB = true
	spring_.CFrame = spring_.CFrame*CFrame.new(0, -0.5, 0)
	script.Parent.s1:Play()
	wait(0.10)
	DB = false
	spring_.CFrame = spring_.CFrame*CFrame.new(0, 0.5, 0)
	end
end

script.Parent.Touched:connect(onTouch)
Script: "s"
-- CreativeCurvyCat / Cat 	[02/20/18]

--[[
	This code took me about 2 hours to do, 
	
	I could just use Roblox's normal physics (Part's Velocity property), but it's really gross
	and broken, so I just made this one.
	
	Also, be sure to credit me if you're gonna use this in your game.
	
	UPDATE: 'RunService' function has been removed from the script due that it only works
	for StarterGui, lol.
]]


-- variables:
wait()

v3 = Vector3
v2 = nil

function wt() wait() end -- Smooth

load = 0

repeat wt'' load = load + 1 until load < 2
load = load + 4

velo = 20
s_ = v3.new(script.Parent.Size.x, script.Parent.Size.y, script.Parent.Size.z)
scale = 4

function_ = true

print(v3, 'load: '..load, '')

-- Function (where the magic happens)

function v(f)
	
	v = f.Parent:FindFirstChild'Humanoid'
	
	if (load > 2 and ( (v ~= nil) or (v.Health > 0) ) and function_ == true) and scale > 0 then -- Check if the player and everything else are okay
		
		script.Parent.p1.Enabled, script.Parent.p2.Enabled = true, true
		
		
		v2 = Vector3.new(0, (0 + ((scale - v.Parent.HumanoidRootPart.Velocity.Y) * velo)) - 0, 0) -- Set the Part Velocity
		
		script.Parent.Velocity = v2
		v.JumpPower = (0 + ((scale - v.Parent.HumanoidRootPart.Velocity.Y) * velo)) - 0 -- Set player's jump-power
		
		script.Parent.Velocity = v3.new(0, 0, 0)
		
		v.Jump = true
		script.Parent.Size = v3.new(scale / 2, script.Parent.Size.y/2, scale / 2)
		
		script.Parent:FindFirstChild's1':Play()
		for j = (scale / 2), scale do wait(.05) script.Parent.Size = v3.new(j, j-1, j) end -- Spring animation
		script.Parent.Size = v3.new(scale, 2, scale)
		
		--Reset everything
		script.Parent.p1.Enabled, script.Parent.p2.Enabled = false, false
		script.Parent.Velocity = Vector3.new(0, 0, 0)
		v.JumpPower = 50
		v2 = nil
	end
end

script.Parent.Touched:connect(v)
1 Like

The #help-and-feedback:code-review category is for code that is already completely functional, that need visual improvement and/or better practices.

Your topic belongs in #help-and-feedback:scripting-support if you are intending to receive help on scripts that are not functional already.

2 Likes

Thank you very much for the help :+1:

I didn’t change anything within the scripts, I just posted them with formatting and the model hierarchy. Everything is exactly the same as the model you posted previously.

1 Like

Recategorised and title changed. Please read category guidelines before posting: Code Review is not for broken code. It would also help to have a more detailed title. I’ve changed it according to what the thread seems to be on (a spring), please correct it if it is inaccurate.

1 Like

This should be titled Jump pad script not working, or something similar.
I looked at it thinking you were working on a scripted spring system like you may find in vehicle suspension or something like that.

2 Likes

I used the term ‘jump pad’ in the search bar up top and found this.

The post you put as the solution is just you thanking @bobbybob2131 for the help where all they did was post the scripts and a picture of the hierarchy of the model without changing anything.

Thank you very much for the help :+1: