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?
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.
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)
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?
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)