I’m making a now-defunct game called Rolling Sky on Roblox. But the jump platform works strangely. I’ve already searched for similar issues on the dev forums, but I haven’t found anyone experiencing the same issue as me, and I hope this bug is fixed.
local model = script.model.Value
while model == nil do
task.wait()
model = script.model.Value
print("model")
end
local cha = game.Players.LocalPlayer.Character
local u = cha.Humanoid.Animator:LoadAnimation(model.Upping)
model.c.Changed:Connect(function(val)
if val == true then
if u.IsPlaying == false then
u:Play()
u:AdjustSpeed(0.1)
local bv = Instance.new("BodyVelocity")
bv.Parent = cha.HumanoidRootPart
bv.Velocity = Vector3.new(0, 0, 0)
bv.MaxForce = Vector3.new(0, math.huge, 0)
end
end
end)
model.t.Changed:Connect(function(val)
if val == true then
if cha.HumanoidRootPart:FindFirstChild("BodyVelocity") then
cha.HumanoidRootPart.BodyVelocity.MaxForce = Vector3.new(0, 0, 0)
cha.HumanoidRootPart.BodyVelocity:Destroy()
end
u.TimePosition = 0.999
u:AdjustSpeed(0)
task.wait()
u.TimePosition = 0.999
u:AdjustSpeed(0)
u:Stop()
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
model = script.model.Value
if model.t.Value == false then
if cha ~= nil then
if model.c.Value == false then
if (Vector3.new(cha.HumanoidRootPart.Position.X, cha.HumanoidRootPart.Position.Y, model.JumpPad.Position.Z + -4) - cha.HumanoidRootPart.Position).Magnitude < 4 then
model.h.Value = true
end
end
end
if model.h.Value == true then
if model.c.Value == false then
model.c.Value = true
model.JumpPad.Transparency = 0
model.JumpPadOff.Transparency = 1
end
local magnitude = (1+(-(Vector3.new(cha.HumanoidRootPart.Position.X, cha.HumanoidRootPart.Position.Y, model.JumpPad.Position.Z - 20) - cha.HumanoidRootPart.Position).Magnitude)/20)
u.TimePosition = magnitude
print(magnitude * u.Length)
u:AdjustSpeed(0.01)
u:AdjustWeight(1)
if magnitude > 0.96 then
print("mag2")
model.t.Value = true
end
end
end
end)
Above is the jump platform script. It is a local script, and its parent is a server script, and the server script is a system that copies the local script and inserts it into the player.
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = script.Parent:WaitForChild("HumanoidRootPart")
local moveSpeed = 0.2
local stopThreshold = 0.5
local targetXPosition = player.Position.X
game:GetService("GuiService").TouchControlsEnabled = false
task.wait(10)
script.Parent.Spawn:FireServer() -- game start
RunService.RenderStepped:Connect(function(deltaTime)
local mousePosition = UserInputService:GetMouseLocation()
local viewportSize = workspace.CurrentCamera.ViewportSize
local normalizedX = (mousePosition.X / viewportSize.X) * 2 - 1
targetXPosition = normalizedX * 65
local currentX = player.Position.X
local distance = math.abs(targetXPosition - currentX)
local newX = currentX + (targetXPosition - currentX) * moveSpeed
if script.Parent.Die.Value == true then
player.Position = Vector3.new(player.Position.X, player.Position.Y, player.Position.Z - ((script.Parent.Speed.Value * 60)*deltaTime))
player.Parent:WaitForChild("Head").Position = Vector3.new(player.Parent:WaitForChild("Head").Position.X, player.Parent:WaitForChild("Head").Position.Y, player.Parent:WaitForChild("Head").Position.Z - ((script.Parent.Speed.Value * 60)*deltaTime))
else
player.Position = Vector3.new(newX, player.Position.Y, player.Position.Z - ((script.Parent.Speed.Value * 60)*deltaTime))
player.Parent:WaitForChild("Head").Position = Vector3.new(newX, player.Parent:WaitForChild("Head").Position.Y, player.Parent:WaitForChild("Head").Position.Z - ((script.Parent.Speed.Value * 60)*deltaTime))
end
end)
Above is the player movement script, which is also a local script and is included in StarterCharacterScripts.