Moving player to part

ah i see now, i forgot to do .Value :man_facepalming: also i used the wrong reference for levelchange

1 Like

but make sure you arent adding .Value to the variables because then it will just store that number and it wont change if the value updates
so do:

thanks also i realized i used the wrong path for levelchange as well

i added a print before the if, doesnt work

i dont think it is even running

imma test just adding a while loop to see if the script is even active

@bmxcre it doesnt seem to even run

Can you try

Player.Character:PivotTo(partToMove.Cframe)
Not the best with roblox APIs but I hope that’ll work

the problem right now is that the script doesnt run, but i will test that after this bigger problem is dealt with

either method would work but can you send the most recent script

Can you show your output? I don’t see any reason for it to not work

YEAH what he said ☆*: .。. o(≧▽≦)o .。.:*☆

have you tried moving the player’s rootpart to the desired part’s location :thinking:

my output is empty, nothing gets printed, doesnt even run the script.
code:

local Player = game:GetService("Players").LocalPlayer
local rightbutton = Player.PlayerGui.LevelGui.Main.Right
local levelchange = game.Workspace.StageChange
local lastStage = Player.leaderstats.Stage
local checkpointWord = "Checkpoint"
local tur = true

while tur do
	wait(0.1)
	print("testing")
end

rightbutton.MouseButton1Click:Connect(function() 
	print("testing")
	if (levelchange.Value == lastStage.Value) then
		print("error")
		return "error, last stage currently unlocked"
		
	else
		print("hello?")
		local nextPoint = levelchange + 1
		local placeToMove = checkpointWord .. nextPoint
		local partToMove = workspace:FindFirstChild(placeToMove)
		Player.Character.HumanoidRootPart.CFrame = partToMove.Cframe
	end
end)

You literally have a while loop sitting on top of the event. There’s no way the rest of the script will run, the while loop is preventing it. Remove it

the while loop is there to test whether the script will run or not, which it does not

coroutine.wrap(function()

end)()

Works…!

the while loop will yield the rest of the code below it until it ends

im using the while loop to see if it works, the while loop doesnt print anything, its only there to check if the script even starts to run

While loop pauses the entire script because it is a loop under the same scope.