so let's say you have a leader stat called "kills"
how would make it so when you reach a specific amount, say 5, kills you teleport to another game?
so let's say you have a leader stat called "kills"
how would make it so when you reach a specific amount, say 5, kills you teleport to another game?
Here's a way to do this. I made the leaderstats for you, but you can remove them and put in your own system. Basically, anything that may be new to you is listed in the resources section below the script. In the future, please post your attempt at solving the problem before posting a question. This is a server script
local TeleportService = game:GetService("TeleportService")
local PlaceId = 000
game:GetService("Players").PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = leaderstats
kills:GetPropertyChangedSignal("Value"):Connect(function()
if kills.Value >= 5 then
TeleportService:Teleport(PlaceId,plr)
end
end)
end)
##Resources:
##Accept and upvote if this helps!
not what i was looking for, i'm take about to teleport to another game, as like a actual game with a id
for example your in game one, then when you reach the kills, you go to game 2, another whole game where you teleport to
edited
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can use an event to check if the leaderstat value reached the desired number and just teleport the player.