Part get stuck on RunService:Stepped

  1. What do you want to achieve?
    The target part will return to the wanted position

  2. What is the issue?
    The part kinda get stuck there
    image
    It supposed to look like this at the end
    image

  3. What solutions have you tried so far?
    I tried use TweenService but seems like it doesn’t used for those issues, I tried to turn off CanCollide but the issue still appears

--This is a server script
local M46RE = game.ReplicatedStorage.Folders.Remotes["M.46 Reload"]
M46RE.OnServerEvent:Connect(function()
	local part = script.Parent.Route
	local movetopart = script.Parent.RouteStart
	local returntopart = script.Parent.RouteEnd
	local RS = game:GetService("RunService")
	RS.Stepped:Connect(function()
		part.Position = part.Position:Lerp(movetopart.Position, 0.6)
		wait(2.17)
		part.Position = part.Position:Lerp(returntopart.Position, 0.6)
	end)
end)

So when you move the gun the part moves as well? is it welded or r u using this loop to position it.

Also just noticed you’re running these graphics Server-Side I recommend you do this on the client. All graphics-related things should just be rendered to the client.

Also just read that you should avoid using wait() within run service

It’s welded into the handle of the gun

The last part i don’t get it :neutral_face:

Oh i will try my best to avoid wait()

It’s very important to know what the client-side and Server side is for various reasons i’d try to explain it but not sure if I’d word it perfectly/ or good enough

https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model

What I was saying is that using something like run service on the client would give way better results if you did it within a local script.(Locally / on the client)

Isn’t it just local script and server script?

Yes, Local scripts are for running things on clients and the Server script is for running things on the server.

1 Like