Trouble with client side coding

I’m having trouble coding in LocalScripts. How would I make this script work in a LocalScript? It works just fine in a server script.

The script is in the workspace

local currentPos = script.Parent.Position
local body = Instance.new("BodyPosition")
body.Parent = script.Parent
body.P = 50

while wait(.5) do
	body.Position = Vector3.new(game.Workspace.Part.Position.X, game.Workspace.Part.Position.Y, game.Workspace.Part.Position.Z)
	body.P = 2500
end
1 Like

Fairly simple, LocalScripts don’t work in Workspace.

3 Likes

If you want to do this then simply add a RE (RemoteEvent).

1 Like

LocalScripts don’t work in the Workspace, only in local environments i.e a player’s PlayerGui, PlayerScripts, etc.
I would suggest learning how to use BasePart | Roblox Creator Documentation, as this would usually be the solution to problems like this.

1 Like