I have a game in which the player is a marble, and they can roll around and do small activities throughout the map. It works perfectly fine in the studio, but when I test it using actual Roblox, my marble just rolls around and I can’t control it. I have no idea what could be causing the problem!
Also, not sure if I posted this in the right category.
Might be an accidental click, but make sure any scripts that are used to give your players the ability to move via their control has their “Archivable” Property is set to true
I have accidentally clicked this to false before without realizing until later.
Just checked, and it’s archivable.
Here’s my script:
game["Run Service"].RenderStepped:Wait()
human = script.Parent.Humanoid
sphere = script.Parent.Sphere
root = script.Parent.HumanoidRootPart
isOnGround = false
function move()
isOnGround = workspace:Raycast(root.Position, Vector3.new(0, -3, 0))
if isOnGround then
sphere.Velocity = sphere.Velocity + (human.MoveDirection * human.WalkSpeed)
else
sphere.Velocity = sphere.Velocity + (human.MoveDirection * (human.WalkSpeed / 2))
end
end
game:GetService("RunService").Stepped:Connect(move)
human:GetPropertyChangedSignal("Jump"):Connect(function()
if human.Jump == true then
if isOnGround then
sphere.Velocity = Vector3.new(sphere.Velocity.X, human.JumpPower, sphere.Velocity.Z)
end
end
end)
Can anyone help? I still have no idea what the problem is.
I am going to have to bump this topic because I still haven’t figured it out, and it’s essential to my game! If anyone has any ideas, please let me know!
Sorry that im late, ill tell you whats going on
Whenever you press “play” on the studio, not team test or local server, just play or play here, you will play with your server script and local script, what does this mean?
If you use a server script to do a local script thing or the opposite,it will work Netherless, but when you team test or test in game, you will either run the server script or the local script
So in other words, you might be telling a server script to do a local script thing or the opposite,
Also publish the game if you haven’t
The script for movement that I showed previously is a local script under “StarterCharacterScripts”. I also have a custom starter character consisting of a humanoid, a humanoid root part, and a sphere.
Do you think my problem might have something to do with how it’s connected to RenderStepped?
Maybe, you can try adding prints, test the game and see if you have any prints, if not then youll narrow the problem
Meanwhile ill see the renderstepped
Runservice can be used in both client and server
Also , I realized in the first line you have game[“RunService”] instead of game:getservice
Maybe its because it wont load fast enough
I just went through a series of printing tests, and it appears the function runs every frame, the humanoid walk speed is correct, and the humanoid movement direction is also correct. It must be the actual velocity change causing the problem…
Do you have any idea how to fix it?
You can try printing the velocity’s value too
Interesting… when I print the velocity and try to move, it’s incorrect. I was at a standstill, but it was printing a non-zero vector when I try to move. I think it has to do with how I used a local script, so the server still thinks the sphere is stationary. I’ll try a regular script.
Alright man, i will wait for your result
So… I turned it into a normal script, and that meant I couldn’t use RenderStepped, so I used Heartbeat. Now, whenever I move, the gravity gets all wonky. Here’s a video of what I mean:
robloxapp-20230905-1531408.wmv (6.4 MB)
The parts where I fall normally are when I stopped moving, but when I moved I could float.
Why cant you use renderstepped?
I get an error in the console saying that “RenderStepped event can only be used from local scripts”