So, I made this.. All of it works in studio testing, but when I try ingame heres what happens: The Gui's text changing works (The button saying stuff like: "Teleporting to base in: 3" that for example), the force field on the teleport to base works, anchoring the player and unanchoring the player works... The problem is the teleport part... It doesn't work, it doesn't bring the player where it's ment to go, it doesn't do anything..... Just leave the player where it is, umm but it still works in studio testing..? :/ Nothing in output.. Help me?...??.. :c
PlayerInBattle = script.Parent.PlayerInBattle
function clicked()
local battletarget1 = CFrame.new(42.983, 14.6, -49.147)
local battletarget2 = CFrame.new(-40.468, 14.6, -49.133)
local battletarget3 = CFrame.new(-42.749, 14.6, 41.207)
local battletarget4 = CFrame.new(40.703, 14.6, 41.193)
local spawntarget = CFrame.new(189.87, 69.6, -216.3)
local player = script.Parent.Parent.Parent
local Torso = player.Parent.Character:WaitForChild ("Torso")
if PlayerInBattle.Value == false then
script.Parent.Text = "Entering battle in: 3"
Torso.Anchored = true
wait(1)
script.Parent.Text = "Entering battle in: 2"
wait(1)
script.Parent.Text = "Entering battle in: 1"
wait(1)
local randombattlespawn = math.random(1,4)
if randombattlespawn == 1 then
local Torso1 = player.Parent.Character:WaitForChild ("Torso")
Torso1.CFrame = battletarget1
PlayerInBattle.Value = true
end
if randombattlespawn == 2 then
local Torso1 = player.Parent.Character:WaitForChild ("Torso")
Torso1.CFrame = battletarget2
PlayerInBattle.Value = true
end
if randombattlespawn == 3 then
local Torso1 = player.Parent.Character:WaitForChild ("Torso")
Torso1.CFrame = battletarget3
PlayerInBattle.Value = true
end
if randombattlespawn == 4 then
local Torso1 = player.Parent.Character:WaitForChild ("Torso")
Torso1.CFrame = battletarget4
PlayerInBattle.Value = true
end
Torso.Anchored = false
script.Parent.Text = "Click here to teleport back to base!"
elseif PlayerInBattle.Value == true then
script.Parent.Text = "Teleporting to base in: 3"
Torso.Anchored = true
wait(1)
script.Parent.Text = "Teleporting to base in: 2"
local ff = Instance.new ("ForceField")
ff.Parent = Torso.Parent
wait(1)
script.Parent.Text = "Teleporting to base in: 1"
wait(1)
PlayerInBattle.Value = false
local Torso1 = player.Parent.Character:WaitForChild ("Torso")
Torso1.CFrame = spawntarget
Torso.Anchored = false
script.Parent.Text = "Click here to teleport into battle!"
ff:Remove()
end
end
script.Parent.MouseButton1Click:connect(clicked)

2 comments
Hmm, I'll try this then..
works :D