#why this simple click script doesn't work?

13 messages · Page 1 of 1 (latest)

mental skiff
#

click for money script:

local part = game.Workspace.Button.Interraction
local clickDetector = script.Parent.ClickDetector

clickDetector.MouseClick:Connect(function()
    game.Players.LocalPlayer.leaderstats.Fragments.Value = game.Players.LocalPlayer.leaderstats.Fragments.Value + 1
end)

leaderstats script:

local function onPlayerJoin(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player
    
    local frags =Instance.new("IntValue")
    frags.Name = "Fragments"
    frags.Value = 0
    frags.Parent = leaderstats
end

game.Players.PlayerAdded:Connect(onPlayerJoin)

and error

astral holly
#

Hii, show me the full script in a screenshot

mental skiff
#

hey!

#

and leaderstats

#

uhh leaderstats are in serverscriptstorage

#

yea

#

it should be local script?

#

oo

#

it works

#

is there a diffrence between doing this and switching from server to local script?

#

alr, thanks!

astral holly
#

You may close this now!