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

I'm making a tool that knocks you back for its ability, but it doesnt?

Hi, I'm trying to make a a bat in my game, and it's supposed to knock back players when its ability is used. For some reason, it only works on dummies and not actual players. Does anyone know why? Help would be appreciated.

here is the script in server script service:

	bat.Handle.hitbox.Touched:Connect(function(hit)
		
		if hit.Parent:FindFirstChild("Humanoid") then
			
			if hit.Parent.Name ~= player.Name then
				
				if debounce == false then
					debounce = true
					bat.Handle.BIGHIT:Play()
					game.ReplicatedStorage.Boom:FireAllClients()
					local boom1 = bat.Handle.hit1:Clone()
					local boom2 = bat.Handle.hit2:Clone()
					boom1.Parent = hit.Parent.HumanoidRootPart
					boom2.Parent = hit.Parent.HumanoidRootPart
					boom1.Enabled = true
					boom2.Enabled = true
					
					hit.Parent.HumanoidRootPart.Velocity = char.HumanoidRootPart.CFrame.LookVector * 300 + Vector3.new(0, 30, 0)
					
					hit.Parent.Humanoid:TakeDamage(20)
				 
					
					wait(0.4)
					boom1.Enabled = false
					boom2.Enabled = false
					wait(1)
					boom1:Destroy()
					boom2:Destroy()
					                end
				            end
		        end
	    end)
	end)

1 answer

✓ Accepted answer

DriBowser I finally finished the bat tool. Here is the model and I tested it for both players and NPCs.

It works well, but for the BIGHIT sound inside the handle, you must manually upload the sound effect and change the SoundId. The sound effect is here

Here is the game if you want to test it out first.

21 comments

0

You can also use “FindFirstChildWhichIsA” because it also works and does the same way as “FindFirstChildOfClass”

0

Thanks for the answer, I'll see if it works!

0

Huh, for some reason it still doesn't work. I still doesnt knock the player back and still only works on the dummy. I replaced "if hit.parent:FindFirstChild("Humanoid") with if hit.Parent:FindFirstChildOfClass("Humanoid") do you know why?

0

I also tried with the other version.

0

Oh wait I think something is wrong to your script, I'll edit my answer rq

0

It still wont work?? Sorry I keep bugging you lol but ive needed to fix this for a while

0

Do you have a script in your bat tool? Have you used Tool.Activated in your tool? Maybe that’s the problem?

0

I won’t get mad if you keep bugging me lol. I just wanted to help people and get my answer accepted.

0

oh no, the script is inside of server script service. It happens when i remote event is fired from the bat

0

sorry for the confusion

0

wdym

0

can you send me a model of your tool and the script in your serverscriptservice? i might fix it myself

0

https://www.roblox.com/library/10117539864/help Heres the model with everything inside

0

Thank you

0

I’m almost done with the tool. I’ll send it to you tomorrow. I also notice your roblox profile and you have a game.

0

yes lol

0

just to clarify to use the ability is e, sorry i didnt say before

0

sorry for the delay, but i will send you the tool tomorrow. i delayed the fixing of the tool because of the new mimic update.

0

No worries, take all the time you need. I understand.

0

Done! I finished the bat tool and I edited the answer. You're welcome!

0

It finally works!! Thank you so much! I was kind of just wondering if you would mind maybe explaining it, but you dont have to. Just because I'm still fairly new to scripting and dont really understand what you did lol

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