This is in a script which is a local script's parent.I keep getting Touched is not a valid member of LocalScript error even tho'I've made that script on a script... Any suggestions?
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 50
end
end)
wait(3)
Player = script.Parent.Parent.Parent
n = script.Parent
local debounce = false
mouse = Player:GetMouse()
run = game:GetService("RunService")
function pizza(mouse)
if debounce == false then
debounce = true
local x = Instance.new("Part")
x.Shape = "Ball"
x.CanCollide = false
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Transparency = 0.45
x.Parent = Workspace
x.Size = Vector3.new(10, 50, 10)
x.BrickColor = BrickColor.new("Bright red")
x.Name = Player.Name
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*110
x.Parent = Workspace
y.Parent = x
f = Instance.new("Fire", x)
f.Heat = 0
f.Size = 12
x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -10)
game.Debris:AddItem(x, 10)
end
wait(35)
debounce = false
end
function onSelected(mouse)
mouse.Button1Down:connect(function() pizza(mouse) end)
end
n.Selected:connect(onSelected)

3 comments
Can you take a screenshot of the hierarchy that this script is a part of? Your description isn't making any sense.
script.Parentis referring to a LocalScript, not a Part like it has to.I think I solved this myself somehow, but sure.
I've put the script in this one, deleted the Script tool and changed script.Parent to x