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

Starter character script not working?

So I made a script that I know that works, as I put the script inside other objects, and it works. But, the problem is for some reason, if I try to put it inside of my starter character, which I am putting the script inside of each part of the player model, and it doesn't work. I have the starter model setup, with each part correctly named. I have the script here, although it is a bit messy.

function onTouched(hit)
	if hit.Parent:findFirstChild("Humanoid") then
		hit:Destroy();
		local sound = Instance.new("Sound")
		sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
		sound.Parent = script.Parent
		sound.Volume = 1
		sound:play()
		explosion = Instance.new("Explosion")
		explosion.BlastRadius = 12
		explosion.BlastPressure = 1000000 -- these are really wussy units

		-- find instigator tag
		local creator = script.Parent:findFirstChild("creator")
		explosion.Position = script.Parent.Position
		explosion.Parent = game.Workspace
		script.Parent:Destroy();
		
	end
	
end

script.Parent.Touched:connect(onTouched)

1 answer

Try adding some waits, or maybe use ~= if humanoid nil, and not an "if"

1 comment

0

What line?

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