Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Cannot change location of a part?

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago
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)
0
I'd suggest using Vector3 in this case instead of CFrame. greatneil80 2647 — 2y
0
Thank you so much! This worked MikelTheWolf 2 — 2y
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 Gmorcad12345 434 — 2y
Ad

Answer this question