Hello, I have a large problem to fix. I want to add to my place Points Leaderboard GUI and when you hit part which give you points it should show how many points i have in GUI. Here is some scripts: Leaderboard GUI:
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model",player)
leaderstats.Name = "leaderstats"
local points = Instance.new("IntValue",leaderstats)
points.Name = "Points"
points.Value = 0
local P = game.StarterGui.Points.Frame.Point
end)
wait(0)
P.Text = "Points: "..points.Value
Maybe i added it to wrong place. Script is in StarterGUI>Points
Here is script from Point part which after hit should give me 1 point.
waittime = 5 -- Time Between each hit
amnt = 4 --how much you get for it
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Points")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
script.Parent.Transparency = 1
script.Disabled = true
wait(waittime)
script.Parent.Transparency = 0
script.Disabled = false
end
end
script.Parent.Touched:connect(onTouched)
So i don't know how to make them work together.

1 comment
Oh, sorry about never responding. I was offline all of yesterday. I had things going on.