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

Client sided shop unwanted?

Asked by 6 years ago
Edited 6 years ago

Hello guys i am trying to make 3D shop so it works now only problem is when items move to player's backpack they are client sided so only owner can see them. I need to fix that with remote function but i never used remote functions before . Here is what i made: local script

Pur.MouseButton1Down:connect(function()
    createPartEvent:FireServer(player, Purchase)
end)

server script (location = game.ServerScriptService)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = game.ReplicatedStorage:WaitForChild("GuiHandler")
local player = game.Players.LocalPlayer
local timed = 0

local function onCreatePartFired(Purchase)
    print("CONNECTED")
    wait(1)
    finished = workspace.ToolCams:FindFirstChild("Focus"..timed)
    local cash = player.leaderstats.KG
    char = player.Character
    local Tools = char:FindFirstChild("tool")
    if cash.Value >= finished.Cost.Value then
            player.CurrentTool.tool:Destroy()
            local item = game.ReplicatedStorage.Tools:FindFirstChild(finished.Item.Value):Clone().Parent == player.Backpack
            item.Name = "tool"
    end
end

i think there is 2 problems actually 1st - they are not connecter because it didnt print 2nd - wrong argument in local script but i dont know how to fix that because output not showing me my errors so i dont know what i have to fix.

0
Please use the LUA code block, others are confused of what you are trying to say. BuzzKillGT 33 — 6y
0
idk how theswagboy0813 -14 — 6y
0
done theswagboy0813 -14 — 6y

1 answer

Log in to vote
0
Answered by
Aimarekin 345 Moderation Voter
6 years ago

The player variable and the purchase variable don't seem to exist. You are getting the error because in

createPartEvent:FireServer(player, Purchase)

you haven't specified what the player is equal to, neither the purchase. Because of the error, the code breaks and therefore, the remote isn't fired.

Ad

Answer this question