local name = script.Parent.Parent.ItemName local resources = script.Parent.Parent.Resources local itemgiven = script.Parent.Parent.ItemGiven local wood = game.Players.LocalPlayer.rStats.WoodStat local stone = game.Players.LocalPlayer.rStats.StoneStat local cloth = game.Players.LocalPlayer.rStats.ClothStat function craft() --- BOW if name.Text == "Bow" then if wood.Value >= 50 then wood.Value = wood.Value - 50 itemgiven.Text = "Bow given, check your inventory." else if wood.Value < 50 then itemgiven.Text = "Bow not given, not enough wood." end end --- PLEASE SELECT A ITEM elseif name.Text == "Select a Item" then print("Please Select a Item") --- STONE HATCHET elseif name.Text == "Stone Hatchet" then if wood.Value >= 10 then if stone.Value >= 40 then wood.Value = wood.Value - 10 stone.Value = stone.Value - 40 itemgiven.Text = "Stone Hatchet given, check your inventory." end elseif wood.Value < 10 and stone.Value < 40 then itemgiven.Text = "Stone Hatchet not given, not enough wood and stone." elseif wood.Value < 10 and stone.Value >= 40 then itemgiven.Text = "Stone Hatchet not given, not enough wood." elseif wood.Value >= 10 and stone.Value < 40 then itemgiven.Text = "Stone Hatchet not given, not enough stone." --- WOOD HATCHET elseif name.Text == "Wood Hatchet" then if wood.Value >= 30 then if stone.Value >= 10 then wood.Value = wood.Value - 30 stone.Value = stone.Value - 10 print("Wood Hatchet Given") end end end end end script.Parent.Activated:Connect(function() craft() end)
Whats wrong with this script? Please tell me, also if you saw my last question and are annoyed that I'm asking questions this fast, I'm sorry, but I'm a begginer and I want to learn ASAP.
I think its because you either use a localscript, and localscript cant change anything on the server (without help of remotes) or you use a regular script, and regular scripts can't use LocalPlayer. Since you are new into remotes I suggest looking into some of it in the API. Some links you may get need of: https://developer.roblox.com/articles/Remote-Functions-and-Events https://developer.roblox.com/api-reference/function/RemoteEvent/FireClient https://developer.roblox.com/api-reference/event/RemoteEvent/OnClientEvent
Hope this helped you a little bit :)