Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players") -- Getting The Players Service
- for _, child in script.Parent:GetChildren() do -- Looping Through All The Children In The Folder
- if child.Name == "Gem" then
- child.Touched:Connect(function(OtherPart: BasePart) -- Listening To When It Is Touched
- local Character = OtherPart.Parent -- Getting The Character
- local Player = Players:GetPlayerFromCharacter(Character) -- Getting The Player
- if Player then
- child:Destroy() -- Destroying The Gem (So They Can Only Claim It Once)
- Player.leaderstats.Gems.Value += 1
- script.Parent.Sound:Play() -- Playing The Sound
- script.Enabled = false
- task.wait(0.5)
- script.Enabled = true
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement