Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

copied script does not teleport player although original does

  • This website was created by Roblox members to replace the official forums (because Roblox shut them down) Join us if you like Roblox!

jeremqpmfpi

New Member
Reputation: 0 / 0 / 0
Nov 9, 2021
6
0
1
Roblox
jeremqpmfpi
hi, I am making a dev version of my main menu (so debugging can be easier), but I have a problem.

the issue is that i made a script that works for tp'ing to tp block 1. but once I copied the script and changed some stuff, so it would bring me to tp block 1. the copied script does not work!

main local script is in "test map" text button.

copied local script is in "game map" text button.

there is no error!

main script:
main script:
---shortcuts
local players = game:GetService("Players")
local user = players.LocalPlayer
local character = user.Character
local humanoidrootpart = character:WaitForChild("HumanoidRootPart")
local player_gui = user:WaitForChild("PlayerGui")
local play_dev_mode = player_gui:WaitForChild("play dev")
local button = play_dev_mode:WaitForChild("test map")
local TPto = game.Workspace:WaitForChild("tp2")
local player_stats = character:WaitForChild("player stats")
local player_mode = player_stats:WaitForChild("overall mode")

---clicked function
function clicked()

---change player mode
    player_mode.Value = "testing with test map"

---move player
    humanoidrootpart.CFrame = TPto.CFrame
end

---trigger stuff
button.MouseButton1Click:Connect(clicked)

copied script:
copied script:
---shortcuts
local players = game:GetService("Players")
local user = players.LocalPlayer
local character = user.Character
local humanoidrootpart = character:WaitForChild("HumanoidRootPart")
local player_gui = user:WaitForChild("PlayerGui")
local play_dev_mode = player_gui:WaitForChild("play dev")
local button = play_dev_mode:WaitForChild("game map")
local TPto = game.Workspace:WaitForChild("tp1")
local player_stats = character:WaitForChild("player stats")
local player_mode = player_stats:WaitForChild("overall mode")

---clicked function
function clicked()

---change player mode
    player_mode.Value = "playing with game map"

---move player
    humanoidrootpart.CFrame = TPto.CFrame
end

---trigger stuff
button.MouseButton1Click:Connect(clicked)