I have a simple player marble system in place but I cant seem to figure out a way to get the player to stay above the ball.
The The ball is inside the players character model and the ball is welded to the characters humanoidRootPart ( I’ve tried not having the weld be connected to the players character but the ball doesn’t move)
Here is the local script.
local players = game:GetService("Players")
local debris = game:GetService("Debris")
local tween = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
while char.Parent == nil do
task.wait()
char.AncestryChanged:wait()
end
--local hum = char:WaitForChild("Humanoid")
local cam = workspace.CurrentCamera
local jumpdb = false
char.ChildAdded:Connect(function(child)
if child.Name == (char.Name).."sBoulder" then
local boulder = char[char.Name.."sBoulder"]
cam = child
local velocity = Instance.new("BodyAngularVelocity")
velocity.Parent = child
print("hi")
rs.RenderStepped:Connect(function()
char:SetPrimaryPartCFrame(boulder.CFrame + Vector3.new(0, 15, 0))
end)
while true do
wait()
child.BodyAngularVelocity.AngularVelocity = Vector3.new(char.Humanoid.MoveDirection.z * 32, 0, char.Humanoid.MoveDirection.x * -32)
child.BodyAngularVelocity.MaxTorque = Vector3.new(80000, 80000, 80000)
if char.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
child.BodyAngularVelocity.MaxTorque = Vector3.new(0, 0, 0)
end
end
end
end)
uis.InputBegan:Connect(function(input, gameProccessed)
if gameProccessed then return end
if input.KeyCode == Enum.KeyCode.Space and jumpdb == false then
jumpdb = true
local root = char:WaitForChild("HumanoidRootPart")
char[char.Name.."sBoulder"].AssemblyLinearVelocity = char[char.Name.."sBoulder"].AssemblyLinearVelocity * Vector3.new(1, 0 ,1) + Vector3.new(0, 75, 0)
task.delay(2, function() jumpdb = false end)
end
end)