I have two scripts, one is local and triggers when a gui button is pressed, it will send an FireServer to a normal script. When it is fired it also gets sent with a string, depending on the string an elseif statement will let the code work, I have use printing and every bug finding thing I can think of, but it seems that nothing is wrong, but it does not work.
LOCAL SCRIPT (This is not the full script btw, just the part that matters)
local WoodenHookButton = ShopFrame.SframeClip.SFrame.WoodenHook
WoodenHookButton.MouseButton1Click:Connect(function()
local WoodenHook = "WoodenHookWORK"
Event:FireServer(WoodenHook)
end)
MAIN SCRIPT (This is the full script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.GoldBought
Event.OnServerEvent:Connect(function(Player,HookType)
local Folder = Player:WaitForChild("leaderstats")
local IntValue = Folder:WaitForChild("Coins")
local Folder2 = Player:WaitForChild("GoldenHook")
local Owned = Folder2:WaitForChild("Owned")
local Folder3 = Player:WaitForChild("TPose")
local Owned2 = Folder3:WaitForChild("Owned")
local Folder4 = Player:WaitForChild("WoodenHook")
local Owned3 = Folder4:WaitForChild("Owned")
if HookType == "GoldenHook" then
print("1")
if Owned.Value == false then
if IntValue.Value >= 1 then
IntValue.Value = IntValue.Value - 1
Owned.Value = true
end
end
elseif HookType == "TPose" then
if Owned2.Value == false then
if IntValue.Value >= 1 then
IntValue.Value = IntValue.Value - 1
Owned2.Value = true
elseif HookType == "WoodenHookWORK" then
if Owned3.Value == false then
if IntValue.Value >= 1 then
IntValue.Value = IntValue.Value - 1
Owned3.Value = true
elseif HookType == "UpsideDown" then
end
end
end
end
end
end)