#Sell system

1 messages · Page 1 of 1 (latest)

stiff willow
#

help!!!

#
local part = script.Parent
part.Touched:Connect(function(touch)
    local plr = game.Players:GetPlayerFromCharacter(touch.Parent)
    local leaderstats = plr:FindFirstChild("leaderstats")
    if leaderstats then
        local coins = leaderstats:FindFirstChild("Coins")
        local clicks = leaderstats:FindFirstChild("Clicks")
        print(clicks.Value)
        
    end
end)
#

why computer cant read the clicks value ?

drowsy frigate
stiff willow
#

nope

#

@drowsy frigate so u know how to fix it ?

drowsy frigate
stiff willow
#

when i touch block

drowsy frigate
#

Alr then one minute

stiff willow
#

ok

drowsy frigate
#

idk why not working

stiff willow
#

same

cloud phoenix
#

do you change clicks value on server or client

#

cuz if you do Clicks.Value = 200 on client (for example), on server it won't change (and for server it will be 0)

stiff willow
#

like in clint its 7 clicks but on server its 0

cloud phoenix
#

ok so thats the issue

#

you need to use RemoteEvent

stiff willow
cloud phoenix
#

in this case u wanna do (ofc this is just an example)

on client

button.Activated:Connect(function()
  RemoteEvent:FireServer(increment_value)
end

on server

RemoteEvent.OnServerEvent:Connect(function(Player, incrementValue) -- first argument is ALWAYS a Player
  local leaderstats = ...
  local Clicks = leaderstats.Clicks

  Clicks.Value += incrementValue
end)