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

How to Detect players position before they click a button?

Asked by 1 year ago

I have a button that teleports a player to a Position in the baseplate when they click it and I want to record the CFrame they were in before they last clicked it.

0
In the script, naturewizard 85 — 1y
0
In the script, before the teleporting occurs. naturewizard 85 — 1y
0
save the cframe to a variable JustinWe12 723 — 1y

1 answer

Log in to vote
1
Answered by 1 year ago

In order to see the current Cframe of the player you must see it before you teleport them

Try placing this inside of your click detector This is a server script

script.Parent.MouseClick:Connect(function(plr)
    local Char = game.Workspace:FindFirstChild(plr.Name)
    local FirstPosition = Char.LowerTorso.CFrame -- This is where the position he was first at was 
    -- local FirstPosition = Char.Torso.CFrame 
    -- use the code above this to use R6
    Char:MoveTo(game.Workspace.Part.Position) -- Put where you want him to move here
    print(FirstPosition) -- this checks if the script is working(you can delete it)

end)

Ad

Answer this question