Recommended Posts

Hello, I am scripting a panel that will set people into diffrent dimensions. But i need the code for chaning the Dimension Only, Please Every Answer would be to help.

 

 


function teleportPlayer()
    if(source == GUIEditor.button[1]) then
    local teleportX, teleportY, teleportZ = 1210.48621, 2358.32373, 8.01253
        setElementPosition(getLocalPlayer(), teleportX, teleportY, teleportZ)
        outputChatBox("You Have Been Set To The Arabian Server")
    end
end
addEventHandler("onClientGUIClick", root, teleportPlayer)
-------------------------
function teleportPlayer()
    if(source == GUIEditor.button[2]) then
    local teleportX, teleportY, teleportZ = 1923.0625, -1760.005859375, 13.546875
        setElementPosition(getLocalPlayer(), teleportX, teleportY, teleportZ)
        outputChatBox("You Have Been Set To The English Server")
    end
end
addEventHandler("onClientGUIClick", root, teleportPlayer)

Edited by Benjamin171

Share this post


Link to post

You need to use setElementDimension for that. Also you can put them in the same function, just use an elseif statement like this;

function teleportPlayer()
	if(source == GUIEditor.button[1]) then
		local teleportX, teleportY, teleportZ = 1210.48621, 2358.32373, 8.01253
		setElementPosition(getLocalPlayer(), teleportX, teleportY, teleportZ)
		outputChatBox("You Have Been Set To The Arabian Server")
	elseif(source == GUIEditor.button[2]) then
		local teleportX, teleportY, teleportZ = 1923.0625, -1760.005859375, 13.546875
		setElementPosition(getLocalPlayer(), teleportX, teleportY, teleportZ)
		outputChatBox("You Have Been Set To The English Server")
	end
end
addEventHandler("onClientGUIClick", root, teleportPlayer)

 

Edited by Dealman

Share this post


Link to post

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

  • Recently Browsing   0 members

    No registered users viewing this page.