local tool = script.Parent local katana = tool.Katana local db = false local backpack = tool.Parent local player = backpack.Parent local playerStats = player:FindFirstChild("leaderstats") local playerSliced = playerStats:FindFirstChild("In Backpack") local playerSpaces = playerStats:FindFirstChild("Space Available") local function onTouch(partTouched) local canHarvest = partTouched.Parent:FindFirstChild("CanHarvest") if canHarvest then if canHarvest.Value == true and playerSliced.Value < playerSpaces.Value then playerSliced.Value = playerSliced.Value + 1 canHarvest.Value = false partTouched.Transparency = 1 partTouched.CanCollide = false wait(5) canHarvest.Value = true partTouched.Transparency = 0 partTouched.CanCollide = true local function onTouch(partTouched) if canHarvest then if canHarvest.Value == true and playerSliced.Value >= playerSpaces.Value then script.Parent.Handle.Touched:connect(function(Hit) local player = game.Players:GetPlayerFromCharacter(Hit.Parent) player.PlayerGui.NES.Frame.Visible = true wait(2) player.PlayerGui.NES.Frame.Visible = false
i Dont know why it keeps giving me errors about the script.Parent.Handle.Touched:connect(function(Hit) it says it needs to end but ive tried everything heres the code so far!
I don't know what happened in the process of making your script, but you appear to be missing every end
the script needs to have. Normally after typing an if then statement
, the Roblox editor gives an end
to make typing quicker even though you shouldn't rely on the editor. This should be the script you need:
local tool = script.Parent local katana = tool.Katana local db = false local backpack = tool.Parent local player = backpack.Parent local playerStats = player:FindFirstChild("leaderstats") local playerSliced = playerStats:FindFirstChild("In Backpack") local playerSpaces = playerStats:FindFirstChild("Space Available") local function onTouch(partTouched) local canHarvest = partTouched.Parent:FindFirstChild("CanHarvest") if canHarvest then if canHarvest.Value == true and playerSliced.Value < playerSpaces.Value then playerSliced.Value = playerSliced.Value + 1 canHarvest.Value = false partTouched.Transparency = 1 partTouched.CanCollide = false wait(5) canHarvest.Value = true partTouched.Transparency = 0 partTouched.CanCollide = true end end end local function onTouch(partTouched) if canHarvest then if canHarvest.Value == true and playerSliced.Value >= playerSpaces.Value then script.Parent.Handle.Touched:Connect(function(Hit) local player = game.Players:GetPlayerFromCharacter(Hit.Parent) player.PlayerGui.NES.Frame.Visible = true wait(2) player.PlayerGui.NES.Frame.Visible = false end) -- This part needs a parenthesis at the "end" to close the parenthesis past :Connect( end end end
This may fix your end
issue (I did not test, just put ends where I saw they should be), but you may have a few code errors and issues with how you are handling your task. If this is so, feel free to post another question after **trying **to fix your issue.