Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

.Touched not detecting a thrown object?

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

0

You have mispelled player.. You typed in Layer.

1 answer

The problem with your script is that you have mispelled "player".

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)

There.

4 comments

0

Oh sorry, I copied it over wrong. I did spell it correctly in my original script, and there's no issues there. The problem is that the thrown object is not being detected in the .Touched script.

0

Can i have a look at the .Touched script?

0

yeah, it's the first one in my question

0

Does it print anything?

This discussion is preserved as it was. New answers, comments, and votes are closed.