I have a code for a trampoline. It works extremely smoothly in ROBLOX Studio, but it messes up when I join the place that it's in. For some reason, when I use it on server, it turns me invisible and puts a ton of input lag on my controls, along with very slippery movement? It's weird. Does anyone know how to fix this? This is the code in my trampoline:

local bouncestrength = script.Parent.Parent.bouncepower.Value / 6
local debris = game:GetService("Debris")
local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
			1,
			5,
			1,
			0,
			false,
			0
)

local property = {
			Offset = Vector3.new(0, 0, 0);
			Scale = Vector3.new(1, 1, 1)
}

local propertyb = {
			Color = script.Parent.Parent.regularcolor.Value;
}

debounce = true
script.Parent.Parent.Touched:connect(function(part)
	local a = part.Parent:FindFirstChild("Humanoid")
	if a ~= nil and debounce == true and part.Parent.Torso.Position.Y + 2.87 > script.Parent.Parent.Position.Y + 0.5 then
		debounce = false
		script.Parent.Offset = Vector3.new(0, 0.6, 0)
		script.Parent.Scale = Vector3.new(1.2, 0.8, 1.2)
		script.Parent.Parent.Color = script.Parent.Parent.bouncecolor.Value
		local force = script.Parent.Parent.BodyVelocity:Clone()
		force.Parent = part.Parent.Torso
		debris:AddItem(force, 0.3)
		part.Parent.Torso.Velocity = Vector3.new(part.Parent.Torso.Velocity.X, part.Parent.Torso.Velocity.Y + script.Parent.Parent.bouncepower.Value + bouncestrength, part.Parent.Torso.Velocity.Z)
		local tween = tweenservice:Create(script.Parent, tweeninfo, property)
		local tweenb = tweenservice:Create(script.Parent.Parent, tweeninfo, propertyb)
		tween:Play()
		tweenb:Play()
		wait(0.25)
		force:Destroy()
		debounce = true
	end
end)

3 comments

0

Lines 4-10 hurt...

0

What did that poor function ever do to you? :(