the = sign is underlined red but I dont know how I could fix the problem.
local ShyWhenTouched = script.Parent if ShyWhenTouched.Touched = true then ShyWhenTouched:Destroy() end
The reason your script does not work is because in line 5, an event (like your touched event) can only do 2 things: connect a function
local part= script.Parent part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(100) end
or wait to do code below it.
local part= script.Parent part.Touched:Wait() print("part has been touched")
So you would do the following instead, where you connect a function that destroys the part when it's touched:
local ShyWhenTouched = script.Parent ShyWhenTouched.Touched:Connect(function() ShyWhenTouched:Destroy() end
In conclusion, there is no "bool" to a touched event; it can only connect a function or wait to do code below the line. Hope that works for you, and that you have learned something new :)
part.Touched
is an event, therefore, your script should look like this:
local ShyWhenTouched = script.Parent ShyWhenTouched.Touched:Connect(function() ShyWhenTouched:Destroy() end)