Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Values dosen't change for client?

Asked by 3 years ago

So i made a pick up item script witch should change value to 1 in inventory, but it only changes it for server least i am thinking it is.

local Apple = game.Workspace.Apple
local Apple1 = game.Workspace.Apple1
local Apple2 = game.Workspace.Apple2
local Apple3 = game.Workspace.Apple3
local Apple4 = game.Workspace.Apple4

local Slot1 = game.StarterGui.Inventory.Frame.Slot1.Value
local Slot2 = game.StarterGui.Inventory.Frame.Slot2.Value


-- value 1 means slot is full, value 0 means empty


Apple.ClickDetector.MouseClick:Connect(function() -- once clicked apple does this function
    if Slot1.Value == 0 then
        Apple.Transparency = 1
        Apple.ClickDetector.MaxActivationDistance = 0
        Slot1.Value = 1
    else
     if Slot1.Value == 1 then
            if Slot2.Value == 0 then
                Apple.Transparency = 1
        Apple.ClickDetector.MaxActivationDistance = 0
            Slot2.Value = 1
        end
        end
        end
end)

Apple1.ClickDetector.MouseClick:Connect(function()
    if Slot1.Value == 0 then
        Apple1.Transparency = 1
        Apple1.ClickDetector.MaxActivationDistance = 0
        Slot1.Value = 1
    else
     if Slot1.Value == 1 then
            if Slot2.Value == 0 then
                Apple1.Transparency = 1
        Apple1.ClickDetector.MaxActivationDistance = 0
            Slot2.Value = 1
        end
        end
        end
end)

Apple2.ClickDetector.MouseClick:Connect(function()
    if Slot1.Value == 0 then
        Apple2.Transparency = 1
        Apple2.ClickDetector.MaxActivationDistance = 0
        Slot1.Value = 1
    else
     if Slot1.Value == 1 then
            if Slot2.Value == 0 then
                Apple2.Transparency = 1
        Apple2.ClickDetector.MaxActivationDistance = 0
            Slot2.Value = 1
        end
        end
        end
end)

Apple3.ClickDetector.MouseClick:Connect(function()
    if Slot1.Value == 0 then
        Apple3.Transparency = 1
        Apple3.ClickDetector.MaxActivationDistance = 0
        Slot1.Value = 1
    else
     if Slot1.Value == 1 then
            if Slot2.Value == 0 then
                Apple3.Transparency = 1
        Apple3.ClickDetector.MaxActivationDistance = 0
            Slot2.Value = 1
        end
        end
        end
end)

Apple4.ClickDetector.MouseClick:Connect(function()
    if Slot1.Value == 0 then
        Apple4.Transparency = 1
        Apple4.ClickDetector.MaxActivationDistance = 0
        Slot1.Value = 1
    else
     if Slot1.Value == 1 then
            if Slot2.Value == 0 then
                Apple4.Transparency = 1
        Apple4.ClickDetector.MaxActivationDistance = 0
            Slot2.Value = 1
        end
        end
        end
end)
0
is it a local script? User#34929 0 — 3y
0
no it isn't kristupas12344 26 — 3y

Answer this question