i would really like to know how i could do this for example if im making an obby with gamemodes and i want to make the other players notice what gamemode they are in then when the person touches that gamemode brick it changes the stat of the player to say what ever gamemode it is i would do speed run if this is a bad question then im sorry for wasting your time for the people that dont understand anything i mean like a gamemode stat like NOT A LEVEL a other stat my stat that i used in the example was a gamemode like my leader board has this stage and gamemode do you now understand?
Alright, sorry for my previous answer apparently I did not answer the question. So I kind of get what you mean This is my understanding of what you mean.... If you touch a Part for the Normal GameMode then your leaderstats which is called GameMode turns its value to Normal, however if you touch a brick for Advanced GameMode then your leaderstats which is called GameMode changes to Advanced. Alright I am going to script just how you would do it with a brick for the Normal GameMode. I will explain the script inside of the script using comments...
For the following script to work make sure you have a leaderstats script that make a Model
called leaderstats and it makes a StringValue
called GameMode you may edit the Script at your own leisure. Now then lets get started time to make it so when you touch a Part
it changes the StringValue inside of your player to Normal
local part = script.Parent -- Variable for the part which the character is going to touch. part.Touched:connect(function(hit) -- An anonymous function(Hope you know how to make one) local hum = hit.Parent:WaitForChild("Humanoid") -- Variable to confirm it's a humanoid that touches that part. if hum then -- If statement(Hopefully you know how to make one) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Variable for player using :GetPlayerFromCharacter() method. plr.leaderstats.GameMode.Value = "Normal" -- Changes the value of the StringValue end end)
I hope it helped this time.
in the PlayerSetup script on serverScriptServuce put this code
local function onPlayerJoin(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local gold = Instance.new("IntValue") gold.Name = "ORO" gold.Value = 0 gold.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
in the brick script put this code
local goldPart = script.Parent local function onPartTouch(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") local plr = game.Players:GetPlayerFromCharacter(otherPart.Parent) if ( humanoid ) then plr.leaderstats.ORO.Value = plr.leaderstats.ORO.Value + 10 end goldPart:Destroy() end goldPart.Touched:Connect(onPartTouch)