Hi! So im working on a game which is a combination of two types of games, Tycoon And Obby.
And i tried setting it up so the player will choose where he wants to Respawn, he could choose between two options of course, the Obby or the Tycoon. And i’ve tried to set it up so there is a Folder for all the CheckPoints, And the Character will be Moved (MoveTo) OR Respawn at the Checkpoints Name when its equals to the Stage Value. And for some reason it just doesnt work. i dont get any errors in the Output. And the RespawnLocation doesnt change. I would really like you guys to help me figure out whats wrong here. Thanks!
I decided to put everything in the “leaderstats” Script, Just so you know
the code:
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
print(player.Name)
local Cash = Instance.new("IntValue",leaderstats)
Cash.Name = "Cash"
Cash.Value = 0
local Stage = Instance.new("IntValue",leaderstats)
Stage.Name = "Stage"
Stage.Value = 0
--local obbyv = player:FindFirstChild("ObbyV")
--local tycoonv = player:FindFirstChild("TycoonV")
local Cpoints = game.Workspace.CheckPoints
local Teams = game:GetService("Teams")
local ObbyV = Instance.new("BoolValue", player)
ObbyV.Name = "ObbyV"
ObbyV.Value = false
local TycoonV = Instance.new("BoolValue", player)
TycoonV.Name = "TycoonV"
TycoonV.Value = false
--i dont think anything above this line has something to do with my error but maybe there is idk
player.CharacterAdded:Connect(function(char)
local hum = char:FindFirstChild("Humanoid")
wait()
if ObbyV.Value == true then
player.RespawnLocation = Cpoints[Stage.Value]
--char:MoveTo(Cpoints[Stage.Value].Position)
elseif TycoonV.Value == true then
if player.Team == Teams.Red then
player.RespawnLocation = game.Workspace.Cloud1.RedSpawn
end
end
hum.Touched:Connect(function(hit)
if hit.Parent == Cpoints then
if tonumber(hit.Name) == Stage.Value + 1 then
Stage.Value = Stage.Value + 1
print("Good")
end
end
end)
--end
end)
I also have a code which Set’s up the Player’s RespawnLocation when ever he touches the “Door” Or claims the tycoon. And it does change the Player’s RespawnLocation. Maybe it has something to do with that Code so i’ll leave it here
local door = script.Parent
local Teams = game:GetService("Teams")
local Name1 = script.Parent.SurfaceGui.TextLabel
door.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.Team = Teams.Red
plr.RespawnLocation = game.Workspace.Cloud1.RedSpawn
door.Transparency = 0.65
door.CanCollide = false
door.CanTouch = false
Name1.Text = plr.Name
end)
Thanks!