Beginner Scripter here, So my script isn’t working and I get an error called: expected assignment or function call. Can anyone help me?
Code:
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Visible = true
game.Players.LocalPlayer.Character.Humanoid:UnequipTools()
end
end)
script.Parent.TouchEnded:connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Visible = false
end)
if script.Parent.Touched then game.StarterPack.ClassicSword.SwordScript.Disabled
end
script.Parent.Touched:Connect(function(Touched)
end)
also to disable the script you can do script.Disabled = true and you can’t access to StarterPack when the game is executing cause everything on starterpack will go to the Backpack after you run the game
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.PlayerGui.ScreenGui.TextLabel.Visible = true
hit.Parent:FindFirstChild("Humanoid"):UequipTools()
-- player.Backpack.ClassicSword.SwordScript.Disabled = true
end
end)
Also I just noticed you’re disabling the script which is inside the StarterPack not which is in the character/backpack. Also you don’t need to disable the script because there’s no point for it. But still if you need you can remove the comment from the code above.
Ok I realised you ran the function inside the function
your mistake - script.Parent.Touched:Connect(function(Touched)
correct one - script.Parent.Touched:Connect(Touched)