I'm trying to make a part with a clickdetector on it that sells a Katana for 7 KOs at my game. This isn't working and I'm not receiving an error. Any ideas on how to fix this?
local player = game.Players.LocalPlayer
local clickdetector = script.Parent:WaitForChild("ClickDetector")
local sword = game.ServerStorage:WaitForChild("Katana")
clickdetector.MouseClick:connect(function()
if player.leaderstats.KOs.Value >= 7 then
player.leaderstats.KOs.Value = player.leaderstats.KOs.Value - 7
local sword1 = sword:Clone()
sword1.Parent = player.Backpack
local sword2 = sword:Clone()
sword2.Parent = player.StarterGear
end
end)

3 comments
Assuming this is in a LocalScript? ClickDetectors do not work in localscripts.
Also LocalScripts cannot access ServerStorage.
Oh that's why lol