I am making a block sliding across the screen. I am trying to make it move at a faster speed but no matter how many 0s I add to the wait it does not increase. This is probably because I have reached the minimum value.How do I make the block move faster?
(I do not have much experience using vector 3. The x position is at 0.125 studs so the block moves as smoothly as possible. I am using this as a template to understand how Roblox vehicles move using scripts.) This is my code:
local part = script.Parent
while true do
part.Position = part.Position + Vector3.new(0.125, 0, 0)
wait(0.00000125)
print("Running")
end
A block sliding across the screen sounds like it’s more important to the client rather than to the server which is why I recommended a client-sided method. Putting stuff like this on the client is generally better as it helps to prevent lag.
Regardless, task.wait and heartbeat are equally viable if OP wants the block to move faster.
Maybe this sounds silly, but if I put it on the client will only be shown to that person and not everyone else in the server or will it just run on the client but everyone will see it?
That’s not silly at all, it’s actually a valid concern; it will only show up for that particular client. To solve this, we have each client run the same script on their own end.
A very easy way to do this is to have a LocalScript in the client that handles the block-moving and a RemoteEvent in ReplicatedStorage where every time it is triggered, the LocalScript moves the block. Then just have the server do FireAllClients() on the RemoteEvent to have every client render the block moving. You could also pass through some parameters to the RemoteEvent if you want the block to be positioned somewhere specific.