Jump to content

How can I save a world to a Skript variable and use it in location()??


Wyndexx

Recommended Posts

Hi!

Here is my code:

if {duelsWorldNum} is not set:
		set {duelsWorldNum} to 1
	if {duelsWorldNum} > 1000:
		set {duelsWorldNum} to 1
	broadcast "%{duelsWorldNum}%"
	set {_server} to "farduelsserver%{duelsWorldNum}%"
	broadcast "%{_server}%"
	broadcast "%{_p}%"
	make console execute command "/mv clone DUELSTEMP %{_server}%"
	if {duelColor::%{_p}%} is "RED":
		teleport {_p} to location(0.5, 65, 2.5, world "%{_server}%", -180, 0.1)
	else if {duelColor::%{_p}%} is "BLUE":
		teleport {_p} to location(0.5, 65, -2.5, world "%{_server}%", 0.1, 0.1)

(this is just a section of it)

 

I have a number so that each individual 'server' will be different. I save the server to a local variable in the function ({_server}) and when I try to use it in my teleport section with the location() function, it brings up an error and says:

"The 4th argument given to the function 'location' is not of the required type world."

 

I need location() to be able to call on that world and teleport the players to it.

Can anyone help?

Main MC account: Gam3rBoi (VIP in MH)

Alt MC account: *Gam3rBoi2147

Farcade server owner

Skripter with 6+ months experience + time learning coding concepts

Message me through the forums if you need anything!

Link to comment
Share on other sites

20 hours ago, Gam3rBoi said:

Hi!

Here is my code:

if {duelsWorldNum} is not set:
		set {duelsWorldNum} to 1
	if {duelsWorldNum} > 1000:
		set {duelsWorldNum} to 1
	broadcast "%{duelsWorldNum}%"
	set {_server} to "farduelsserver%{duelsWorldNum}%"
	broadcast "%{_server}%"
	broadcast "%{_p}%"
	make console execute command "/mv clone DUELSTEMP %{_server}%"
	if {duelColor::%{_p}%} is "RED":
		teleport {_p} to location(0.5, 65, 2.5, world "%{_server}%", -180, 0.1)
	else if {duelColor::%{_p}%} is "BLUE":
		teleport {_p} to location(0.5, 65, -2.5, world "%{_server}%", 0.1, 0.1)

(this is just a section of it)

 

I have a number so that each individual 'server' will be different. I save the server to a local variable in the function ({_server}) and when I try to use it in my teleport section with the location() function, it brings up an error and says:

"The 4th argument given to the function 'location' is not of the required type world."

 

I need location() to be able to call on that world and teleport the players to it.

Can anyone help?


Use something like this
 

teleport {_p} to location(0.5, 65, -2.5, world({_server}), 0.1, 0.1)

 

Edited by AgentGamerPro
  • Like 1

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

3 hours ago, AgentGamerPro said:


Use something like this
 

teleport {_p} to location(0.5, 65, -2.5, world({_server}), 0.1, 0.1)

 

Thank you so much!!!

It brings up no errors, and the world successfully creates and Skript brings the two players into the world with no issues.

Thanks again ❤️

  • Like 1

Main MC account: Gam3rBoi (VIP in MH)

Alt MC account: *Gam3rBoi2147

Farcade server owner

Skripter with 6+ months experience + time learning coding concepts

Message me through the forums if you need anything!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...