I'm trying to make it when a mouse is hovered over a part, the script moves a part called "factoryFaded" from ServerStorage to Workspace, and bring its to the coordinates (-25.222, -0.49, -0.554). It isn't working, and the only output I get says "factoryFaded is not a valid member of Part", and "factoryFaded is not a valid member of ServerStorage"
Here is the script
local click = script.Parent while wait(0.5) do click.MouseHoverEnter:connect(function(player) game.ServerStorage.factoryFaded.Parent = game.Workspace game.Workspace.factoryFaded.Position = Vector3.new(-25.222, -0.49, -0.554) end) click.MouseHoverLeave:connect(function(player) game.Workspace.factoryFaded.Parent = game.ServerStorage end) click.MouseClick:connect(function(player) end) end
You don't want a while loop as this will keep creating connections which will result in the functions being called multiple times. (Therefore attempting to move the part multiple times resulting in an error).
It's also better to save what you're changing as a variable and manipulate it that way.
local click = script.Parent local factoryFade = game.ServerStorage.factoryFaded click.MouseHoverEnter:connect(function(player) factoryFade.Parent = workspace -- Now that you have told me factoryFade is a model you have two options: --factoryFade:MoveTo(Vector3.new(-25.222, -0.49, -0.554)) --or (if you've set factoryFade.PrimaryPart) --factoryFade:SetPrimaryPartCFrame(CFrame.new(-25.222, -0.49, -0.554)) end) click.MouseHoverLeave:connect(function(player) factoryFade.Parent = game.ServerStorage end) click.MouseClick:connect(function(player) end)