RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a point system GUI where the player can collect points after collecting objects"
-- First, create a GUI to display the points. This is a local script inside a ScreenGui in StarterGui. local player = game:GetService("Players").LocalPlayer local pointsLabel = script.Parent.PointsLabel player.leaderstats.Points.Changed:Connect(function(newValue) pointsLabel.Text = "Points: " .. newValue end) -- Next, create a script for the part that the player can collect to gain points. This is a server script inside the part. local part = script.Parent local pointsToAdd = 1 local function collect(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then player.leaderstats.Points.Value = player.leaderstats.Points.Value + pointsToAdd part.Position = Vector3.new(math.random(-100, 100), part.Position.Y, math.random(-100, 100)) end end part.Touched:Connect(collect)