Changing TeleportValue for server when user clicks a button

You can write your topic however you want, but you need to answer these questions:
I have a game where you teleport to other specific worlds when clicked a button. The problem is that when you click this button teleportvalue wont change for the server, and i have NO idea how to make this work
Also i am pretty bad at scripting so if someone answers this could you try to explain it to me?


(the value is inside the player)

[please excuse i am also bad at drawing]

I have tried searching every possible solution on developer forum but that didnt help me for some reason

2 Likes

You should create an attribute for each button which has the place id of the world you want to tp to. When the player clicks, you can fire a remote event to the server with the value of the button’s placeid attribute value and then tp from there.

1 Like

can you tell me a bit more on how to do that?

1 Like

oh also, i forgot to mention that every place uses the same description frame and i change name, ‘description’ and place id with a script

1 Like

I mean for each button that tps you to a different world you create an attribute for them by clicking the + in the attribute section in their properties and set the value to the placeid of the place you wanna tp to. Do this for all buttons. Then when the player clicks…

local button = script.Parent
button.Activated:Connect(function()
   game.ReplicatedStorage.TPEvent:FireServer(button:GetAttribute(“PlaceID”)
end)

On the server script…

game.ReplicatedStorage.TPEvent.OnServerEvent:Connect(function(plr,id)
   — Tp them with the id 
end)
1 Like

In your picture there are multiple buttons for each world right?

1 Like

here how it looks like
image

is there any way to “store” these attributes for server to use? i mean when players clicks the game button server gets that attribute and if player also clicks “play” server uses that attribute?

1 Like

Like I said, you fire a remote event to the server. The remove event will return the player who fired it for you to modify. You said that the value is in the player. So just get that value from the player returned by the event on the server

event.OnServerEvent:Connect(function(plr —[[plr object]]—)
   local tpvalue = plr.TeleportValue
   — Change here
end)
1 Like

alright, i will try that, if that works, thanks a lot!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.