Hello, so my goal is to make a button so that when you click it, it will randomly teleport you to a part. I’m not the best at scripting so I decided to come here and give as much detail as possible.
Teleports:
Deploy:
Hello, so my goal is to make a button so that when you click it, it will randomly teleport you to a part. I’m not the best at scripting so I decided to come here and give as much detail as possible.
Teleports:
Deploy:
This post was flagged by the community and is temporarily hidden.
This can be done using character.HumanoidRootPart.Position
local Teleports = workspace.Teleports:GetChildren()
local button = script.Parent
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local function OnButtonClicked()
local RandomSpawn = Teleports[math.random(1, #Teleports)]
local Character = player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
HumanoidRootPart.CFrame = CFrame.new(RandomSpawn.Position) + Vector3.new(0,10,0)
end
button.MouseButton1Click:Connect(OnButtonClicked)
put that in a local script and make sure that the button parent is the local script
I don’t think teleporting should be client-sided, but the rest would work.
Edit: nevermind, entirely forgot about how positions are replicated, haha. My bad.
well you can teleport people in the client
This post was flagged by the community and is temporarily hidden.
he can use remote events but if you can teleport someone in client what is the point