Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Where do I put this script? [Unsolved]

3 answers

It can either be in Workspace or ServerScriptService.

1 comment

0

I tried both of those, and it did not work. :C

You put the script in Workspace because it is dealing with Leaderboards and we use the PlayerAdded event in game.Players. Oh and to add the code you press the Lua button while highlighting the code. (EDIT) The code that was provided didn't work because it didn't name the stats Value to leaderstats.

local GroupID = 1

game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats" -- Add this
local rank = Instance.new("StringValue", stats)
rank.Name = "Rank" -- Add this
rank.Value =player:GetRoleInGroup(GroupID)
stats.Parent = player
--[[player.CharacterAdded:connect(function(character)
local groupSpawns = game.Workspace:FindFirstChild("GroupSpawns"):GetChildren()
local torso = character:WaitForChild("Torso")
torso.CFrame = CFrame.new(groupSpawns[math.random(1,#groupSpawns)].Position)
end)]]
end)

7 comments

0

I tried putting it in Workspace, it did not work. Am I doing the script wrongly?

0

First of all did you change the groupId?

0

Where it says local GroupID- (I changed it to the ID of my group) So I believe so.

0

Add, stats.Name = "leaderstats" ,under where the "local stats" is.

0

Also add rank.Name = "Rank" above rank.Value.

0

Sorry, I don't understand what I have to do. What do I have to add to stats.Name = "leaderstats" and rank.Name = "Rank" ?

0

Just replace the code with whats above.

This discussion is preserved as it was. New answers, comments, and votes are closed.