Forum > Coding >

[Help] Teleport to specific place

WetWipes

Professional Idiot

vip

Posts: 162

Threads: 35

Joined: Sep, 2020

Reputation: 15

Posted

alright so im tweaking a lumber tycoon 2 script and im trying to make it so that when i use autobuy instead of the items going to my plot it either goes to a specified spot or specified x y z but nothing has worked yet and im about to give up, please help lol. here is the part of the script im trying to change if its any help to you :)

 

if Base == nil then Base = game:GetService('Players').LocalPlayer.Character.Humanoid.Torso.CFrame end local Money local Cframe for i,v in pairs(game.Workspace.Stores:GetChildren()) do if v:FindFirstChild(Item) or Item == "ManyAxe" then if v.Name == "WoodRUs_" then repeat Money = game.Players.LocalPlayer.leaderstats.Money.Value Cframe = game.Workspace.Stores.WoodRUs.Counter v:WaitForChild(Item) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time2) Drag(v[Item].Main) wait(Time2) v[Item].PrimaryPart.CFrame = Cframe.CFrame + Vector3.new(0,3,0) wait(0.1) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time1) local A_1 = { ["Character"] = game:GetService("Workspace").Stores.WoodRUs.Thom, ["Name"] = "Thom", ["ID"] = 11, ["Dialog"] = game:GetService("Workspace").Stores.WoodRUs.Thom.Dialog } local A_2 = "ConfirmPurchase" local Event = game:GetService("ReplicatedStorage").NPCDialog.PlayerChatted Event:InvokeServer(A_1, A_2) wait(0.1) Check(Base) if Money ~= game.Players.LocalPlayer.leaderstats.Money.Value then Quantity.Text = Quantity.Text - 1 end until tonumber(Quantity.Text) < 1 or game.Players.LocalPlayer.PlayerGui.NoticeGUI.Notice.Visible == true break elseif v.Name == "CarStore_" then Cframe = game.Workspace.Stores.CarStore.Counter repeat Money = game.Players.LocalPlayer.leaderstats.Money.Value v:WaitForChild(Item) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time2) Drag(v[Item]) wait(Time2) v[Item].PrimaryPart.CFrame = Cframe.CFrame + Vector3.new(0,3,0) wait(0.1) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time1)

it would help if i knew how to get the x y z position of where something is but from what ive learnt i cant do that and have to guess? i dont know, help!
  • 0

Wethub Discord: https://discord.gg/aYHr5X2v6H

Posts: 1372

Threads: 87

Joined: May, 2018

Reputation: 24

Replied

hard to read since its minified (its 2:15 am lol)

 

 

by the last sentence, you don't have to guess where it is, what i usually do is go to the spot that you want, and print out your position, unless you are talking about unreachable place? Or you can attempt printing out an object's position

 

sorry didnt understand very well (if i answered wrong)

2:15 am slow brain moment

  • 0

Hello there

#StayHome

 

WetWipes

Professional Idiot

vip

Posts: 162

Threads: 35

Joined: Sep, 2020

Reputation: 15

Replied

@LONG

its 00:19 for me

but basically what im trying to do is that when it autobuys the >Item< instead of making it teleport to my Plot of Land (Base) it teleports to someone elses so say it will always teleport the item to PLOT ONE instead of my plot, PLOT TWO

  • 0

Added

@LONG

if you wish to read the relevant bits then this should be them

 

local ManyPart = Instance.new("Part", game.Workspace) ManyPart.Anchored = true ManyPart.Size = Vector3.new(15,0.1,15) ManyPart.Position = Vector3.new(534.33, -18, -1715.81) ManyPart.Material = "Glass" ManyPart.Transparency = 0.5 BuyItem.MouseButton1Down:connect(function() local Item = TextLabel.Text local Quant = Quantity.Text local Time1 = 0.5 local Time2 = 0.1 local Base for i, v in pairs(game.Workspace.Properties:GetChildren()) do if v.Owner.Value == game.Players.LocalPlayer then Base = v.OriginSquare.CFrame + Vector3.new(0,5,0) end end if Base == nil then Base = game:GetService('Players').LocalPlayer.Character.Humanoid.Torso.CFrame end local Money local Cframe for i,v in pairs(game.Workspace.Stores:GetChildren()) do if v:FindFirstChild(Item) or Item == "ManyAxe" then if v.Name == "WoodRUs_" then repeat Money = game.Players.LocalPlayer.leaderstats.Money.Value Cframe = game.Workspace.Stores.WoodRUs.Counter v:WaitForChild(Item) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time2) Drag(v[Item].Main) wait(Time2) v[Item].PrimaryPart.CFrame = Cframe.CFrame + Vector3.new(0,3,0) wait(0.1) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time1) local A_1 = { ["Character"] = game:GetService("Workspace").Stores.WoodRUs.Thom, ["Name"] = "Thom", ["ID"] = 11, ["Dialog"] = game:GetService("Workspace").Stores.WoodRUs.Thom.Dialog } local A_2 = "ConfirmPurchase" local Event = game:GetService("ReplicatedStorage").NPCDialog.PlayerChatted Event:InvokeServer(A_1, A_2) wait(0.1) Check(Base) if Money ~= game.Players.LocalPlayer.leaderstats.Money.Value then Quantity.Text = Quantity.Text - 1 end until tonumber(Quantity.Text) < 1 or game.Players.LocalPlayer.PlayerGui.NoticeGUI.Notice.Visible == true break elseif v.Name == "CarStore_" then Cframe = game.Workspace.Stores.CarStore.Counter repeat Money = game.Players.LocalPlayer.leaderstats.Money.Value v:WaitForChild(Item) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time2) Drag(v[Item]) wait(Time2) v[Item].PrimaryPart.CFrame = Cframe.CFrame + Vector3.new(0,3,0) wait(0.1) Tlprt(v[Item].Main.Position.X + 3 ,v[Item].Main.Position.Y ,v[Item].Main.Position.Z + 3) wait(Time1) local A_1 = {

 

  • 0

Wethub Discord: https://discord.gg/aYHr5X2v6H

Posts: 1372

Threads: 87

Joined: May, 2018

Reputation: 24

Replied

@WetWipes

does the other plot have a specific name? if so you can try finding that name and get the xyz of it

 

local pos = game.Workspace.whateverthisisidkpp.Position

 

 

 

  • 0

Hello there

#StayHome

 

WetWipes

Professional Idiot

vip

Posts: 162

Threads: 35

Joined: Sep, 2020

Reputation: 15

Replied

@LONG

from the looks of it they are called base or land here is a example:

Tlprt(Base.Position.X, Base.Position.Y, Base.Position.Z)

this teleports me to my base i believe ^

this bit made me think but i dont think it is relevant

local LandPos = { CFrame.new(MyBase.X + 40, MyBase.Y, MyBase.Z), CFrame.new(MyBase.X - 40, MyBase.Y, MyBase.Z), CFrame.new(MyBase.X, MyBase.Y, MyBase.Z + 40), CFrame.new(MyBase.X, MyBase.Y, MyBase.Z - 40), CFrame.new(MyBase.X + 40, MyBase.Y, MyBase.Z + 40), CFrame.new(MyBase.X + 40, MyBase.Y, MyBase.Z - 40), CFrame.new(MyBase.X - 40, MyBase.Y, MyBase.Z + 40), CFrame.new(MyBase.X - 40, MyBase.Y, MyBase.Z - 40), CFrame.new(MyBase.X + 80, MyBase.Y, MyBase.Z), CFrame.new(MyBase.X - 80, MyBase.Y, MyBase.Z), CFrame.new(MyBase.X, MyBase.Y, MyBase.Z + 80), CFrame.new(MyBase.X, MyBase.Y, MyBase.Z - 80), CFrame.new(MyBase.X + 80, MyBase.Y, MyBase.Z + 80), CFrame.new(MyBase.X + 80, MyBase.Y, MyBase.Z - 80), CFrame.new(MyBase.X - 80, MyBase.Y, MyBase.Z + 80), CFrame.new(MyBase.X - 80, MyBase.Y, MyBase.Z - 80), CFrame.new(MyBase.X + 40, MyBase.Y, MyBase.Z + 80), CFrame.new(MyBase.X - 40, MyBase.Y, MyBase.Z + 80), CFrame.new(MyBase.X + 80, MyBase.Y, MyBase.Z + 40), CFrame.new(MyBase.X + 80, MyBase.Y, MyBase.Z - 40), CFrame.new(MyBase.X - 80, MyBase.Y, MyBase.Z + 40), CFrame.new(MyBase.X - 80, MyBase.Y, MyBase.Z - 40), CFrame.new(MyBase.X + 40, MyBase.Y, MyBase.Z - 80), CFrame.new(MyBase.X - 40, MyBase.Y, MyBase.Z - 80) } local Slots = {} for i, v in pairs(Base:GetChildren()) do if v.Name == "Square" then Slots[#Slots+1] = v.Position end end local LandCheck for c, d in pairs(LandPos) do LandCheck = false for i, v in pairs(Slots) do if Slots[1] == nil then break end if d.X == v.X and d.Z == v.Z then LandCheck = true break end end if LandCheck == false then SpawnBase(d) end end end)

 

if i can find a land mark's x y z then i could find the bases/plots x y z,  will i have to find the exact base's/land's x y z?

  • 0

Wethub Discord: https://discord.gg/aYHr5X2v6H

Posts: 1372

Threads: 87

Joined: May, 2018

Reputation: 24

Replied

@WetWipes

 

alright so lt2 stores all its plots in a folder in workspace, every property (plot) has an object value stating whos the owner

and with a part that is called OriginSquare (for every property, will not only be origin square if property is large, each square has a part)

 

you could possible make it check the object value to someones name and select that property's xyz and move the xyz around for your liking. Don't have time to make script, since i got to go sleep, good luck with the script!

  • 0

Hello there

#StayHome

 

WetWipes

Professional Idiot

vip

Posts: 162

Threads: 35

Joined: Sep, 2020

Reputation: 15

Replied

@LONG

can u quickly tell me this one thing though, how do you find this out?

  • 0

Wethub Discord: https://discord.gg/aYHr5X2v6H

Posts: 1372

Threads: 87

Joined: May, 2018

Reputation: 24

Replied

@WetWipes

On my phone rn, I used dex explorer to go through workspace and found a folder that is filled with all the plots

  • 0

Hello there

#StayHome

 

Users viewing this thread:

( Members: 0, Guests: 0, Total: 0 )