What do you mean? (characters)
What this script does? I think its for checkpoints but it doesnt look very good.
I adjusted all of the text to teleportedstage but it still teleports you to stage when you die.
You should’ve not done that. Only replace Stage to TeleportedStage in the script where you teleport character to checkpoint on respawn.
That’s what I did, though. (chars)
Can you show me that script then? Also you said you replaced every Stage to TeleportedStage
local checkpoints = workspace:WaitForChild("Checkpoints")
local coinremote = game.ReplicatedStorage:WaitForChild("CoinGet")
local ms = game:GetService("MarketplaceService")
local vip = 25751808
local mvp = 25751816
local dc = 25751830
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = "0"
coins.Parent = leaderstats
local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = "0"
stage.Parent = leaderstats
local prestige = Instance.new("IntValue")
prestige.Name = "Prestige"
prestige.Value = "0"
prestige.Parent = leaderstats
local effectvalue = Instance.new("NumberValue")
effectvalue.Name = "efftime"
effectvalue.Parent = player
wait()
local TeleportedStage = Instance.new("IntValue")
TeleportedStage.Name = "TeleportedStage"
TeleportedStage.Parent = player
TeleportedStage.Value = stage.Value
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
wait()
char:MoveTo(checkpoints[stage.Value].Position)
hum.Touched:Connect(function(hit)
if hit.Parent == checkpoints then
if tonumber(hit.Name) == player.TeleportedStage.Value + 1 then
player.TeleportedStage.Value = player.TeleportedStage.Value + 1
if not ms:UserOwnsGamePassAsync(player.UserId,vip) and not ms:UserOwnsGamePassAsync(player.UserId,mvp) and not ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 5 -- none
elseif ms:UserOwnsGamePassAsync(player.UserId,vip) and not ms:UserOwnsGamePassAsync(player.UserId,mvp) and not ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 6 -- vip
elseif not ms:UserOwnsGamePassAsync(player.UserId,vip) and not ms:UserOwnsGamePassAsync(player.UserId,mvp) and ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 10 -- dc
elseif not ms:UserOwnsGamePassAsync(player.UserId,vip) and ms:UserOwnsGamePassAsync(player.UserId,mvp) and not ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 7 -- mvp
elseif ms:UserOwnsGamePassAsync(player.UserId,vip) and ms:UserOwnsGamePassAsync(player.UserId,mvp) and not ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 7 -- vip,mvp
elseif ms:UserOwnsGamePassAsync(player.UserId,vip) and ms:UserOwnsGamePassAsync(player.UserId,mvp) and ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 10 -- vip,mvp,dc
elseif not ms:UserOwnsGamePassAsync(player.UserId,vip) and ms:UserOwnsGamePassAsync(player.UserId,mvp) and ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 10 -- mvp,dc
elseif ms:UserOwnsGamePassAsync(player.UserId,vip) and not ms:UserOwnsGamePassAsync(player.UserId,mvp) and ms:UserOwnsGamePassAsync(player.UserId,dc) then
coins.Value = coins.Value + 10 -- vip,dc
end
coinremote:FireAllClients()
end
end
end)
end)
end)
Replace this with
char:MoveTo(checkpoints[TeleportedStage.Value].Position)
Thats the only thing you should have changed.
Also your script is just as awful as the first script.
Thank you SO SO much. I finally can get rid of that two thousand line script and replace it with this after 6 WHOLE, DREADFUL months. Thanks!!!
yeah the checkpoints script? i thought about that but it gets the job done.
You are making tens of API calls when player touches checkpoint. You should create BoolValues for every gamepass in every player when they join the game. Then instead of this, you can just check if the player has gamepass like this:
if player.VIP.Value then
coins.Value += 10
end
Also, to make the script shorter, you can give coins like this:
local gamepasses = {
["VIP"] = 5 --How many coins to give?
["MVP"] = 10
["DC"] = 15
}
for k, v in pairs(gamepasses) do --This will iterate through table. k - gamepass name, v - how many coins it gives
if player[k].Value then --Means player has gamepass
coins.Value += v
end
end
Just make sure that you create values with the same name as the keys in this table.
That searches for the gamepass a player has, but they look for it inside the player.
if player[k].Value then
checks for value of the BoolValue you’ve created for player when they joined. For example, if k == “VIP” then it will check the value of BoolValue named “VIP” inside the player.
if player[k].Value then
is the same as if player:FindFirstChild(k).Value == true then
.
I haven’t worked with gamepasses in a while.
What would I set each value to? I forget what the syntax is for checking a player’s gamepass ownership status
local vip = Instance.new("BoolValue")
local mvp = Instance.new("BoolValue")
local dc = Instance.new("BoolValue")
In the same script, where you create TeleportedStage, create 3 BoolValues.
local VIP = Instance.new("BoolValue")
VIP.Name = "VIP"
VIP.Parent = player
local MVP = Instance.new("BoolValue")
MVP.Name = "MVP"
MVP.Parent = player
local DC = Instance.new("BoolValue")
DC.Name = "DC"
DC.Parent = player
local gamepasses = {["VIP"] = 123456, ["MVP"] = 987656, ["DC"] = 019283} --replace with your ID's
for name, ID in pairs(gamepasses) do
local success, ownsPass = pcall(MarketplaceService.UserOwnsGamePassAsync, MarketplaceService, player.UserId, ID)
if success and ownsPass then
player[name].Value = true
end
end
Edit: changed ipairs to pairs
Testing it now, sorry. Applied the edit.
It doesn’t work for some reason. All of it, the coins aren’t given, there isn’t any output, and the stage doesn’t change.
Can you show the script? (chars)
local checkpoints = workspace:WaitForChild("Checkpoints")
local coinremote = game.ReplicatedStorage:WaitForChild("CoinGet")
local ms = game:GetService("MarketplaceService")
local vip = 25751808
local mvp = 25751816
local dc = 25751830
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = "0"
coins.Parent = leaderstats
local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = "0"
stage.Parent = leaderstats
local VIP = Instance.new("BoolValue")
VIP.Name = "VIP"
VIP.Parent = player
local MVP = Instance.new("BoolValue")
MVP.Name = "MVP"
MVP.Parent = player
local DC = Instance.new("BoolValue")
DC.Name = "DC"
DC.Parent = player
local gamepasses = {["VIP"] = 25751808, ["MVP"] = 25751816, ["DC"] = 25751830}
local prestige = Instance.new("IntValue")
prestige.Name = "Prestige"
prestige.Value = "0"
prestige.Parent = leaderstats
local effectvalue = Instance.new("NumberValue")
effectvalue.Name = "efftime"
effectvalue.Parent = player
wait()
local TeleportedStage = Instance.new("IntValue")
TeleportedStage.Name = "TeleportedStage"
TeleportedStage.Parent = player
TeleportedStage.Value = stage.Value
wait()
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
wait()
char:MoveTo(checkpoints[TeleportedStage.Value].Position)
hum.Touched:Connect(function(hit)
if hit.Parent == checkpoints then
for name, ID in pairs(gamepasses) do
local success, ownsPass = pcall(ms.UserOwnsGamePassAsync, ms, player.UserId, ID)
if success and ownsPass then
player[name].Value = true
end
end
There are ‘ends’ and '(ends) at the bottom I just didn’t include them.