What do you want to achieve? Keep it simple and clear!
i wanted to create a working shop system
What is the issue? Include screenshots / videos if possible!
it doesent work with this error. i think the serverscript is the problem, becouse a massage in the localscript printed.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i have tried searching the devforum with no result
Additional information
i have 2 codes, 1 being local and 1 being server.
my localscript:
local replicatedstorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local button = script.Parent
local price = script.Parent.Parent.Parent.CPrice
local chosen = script.Parent.Parent.Parent.CurrentShown
local folder = player:WaitForChild("SwordStatus")
local function onClick()
local havecheck = folder:WaitForChild(tostring(chosen.Value)).Value
if havecheck == true then
replicatedstorage.Own:Fire(player)
else
local coins = player.Coins
if coins.Value == price.Value or coins.Value > price.Value then
local sound = script.Parent.Bought
sound:Play()
replicatedstorage.BuyEvents.BoughtWCoins:FireServer(player)
print("bought")
else
replicatedstorage.Broke:Fire(player)
end
end
end
button.MouseButton1Click:Connect(onClick)
my serverscript:
local price = script.Parent.Parent.Parent.CPrice
local chosen = script.Parent.Parent.Parent.CurrentShown
game.ReplicatedStorage.BuyEvents.BoughtWCoins.OnServerEvent:Connect(function(player)
local folder = player:WaitForChild("SwordStatus")
local sword = folder:WaitForChild(tostring(chosen.Value)).Value
local coins = player.Coins
coins.Value -= price.Value
sword = true
end)
i think the most likely reason is that the player hasnt loaded yet so the folder has not appeared. the script side probably isnt the problem because the error is in the local script. is it possible if you placed the folder variable inside your function?
theres only one value property. mentioning it twice will return nil. i advise that you do revise on your scripting basics, i assume that you are watching a youtube how to do tutorial