I'm using this script to detect when a player throws an object and it would collide with the object this script is in.
script.Parent.Touched:Connect(function()
print("part has been touched")
end)
It runs when colliding with anything but the object that is being thrown. I can't find out why this is happening. Is it because it's a cloned object or something?
Here's the part throwing script I have if that's helpful
Player = game.Players.LocalPlayer
wait(5)
Character = Player.Character
Mouse = Player:GetMouse()
Enabled = true
Mouse.KeyDown:Connect(function(key)
if Enabled == false then return end
key = key:lower()
if key == "q" then
if script.shoesLeft.Value > 0 then
script.shoesLeft.Value = script.shoesLeft.Value - 1
Enabled = false
Fireball = script.placeholderShoe:Clone()
Fireball.Parent = Character
Fireball.CFrame = Character.UpperTorso.CFrame*CFrame.new(0,4,-5.1)
BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(200,200,200)
BV.Velocity = Character.UpperTorso.CFrame.lookVector*250
BV.Parent = Fireball
wait(.1)
BV:Destroy()
wait(5)
Enabled = true
end
end
end)

1 comment
You have mispelled player.. You typed in Layer.