Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Cannot change location of a part?

I am trying to make a button that a player can press and then it immediately disappears so it cannot be pressed again, but when I try to change the coordinates of the part nothing happens. Nothing in the console, nothing.

script.Parent.ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
local Coins = PlayerWhoClicked.leaderstats.Coins
local Job = true
	
while Job == true do
	Coins.Value = Coins.Value + 10
	workspace.JobPart.Position = Vector3.new(0,100,0)
	wait(5)
end
	
end)

How do I change the position of the part? Thanks!

1 answer

✓ Accepted answer
script.Parent.ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
local Coins = PlayerWhoClicked.leaderstats.Coins
local Job = true

while Job == true do
    Coins.Value = Coins.Value + 10
    workspace.JobPart.CFrame = CFrame.new(0,100,0)
    wait(5)
end

end)

3 comments

0

I'd suggest using Vector3 in this case instead of CFrame.

0

Thank you so much! This worked

0

i tried using vector3 in tweens before, and the tween will always end up in 0,0,0. However CFrame worked perfectly fine so i went with CFrame

This discussion is preserved as it was. New answers, comments, and votes are closed.