Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

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

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

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.

0
You can also use “FindFirstChildWhichIsA” because it also works and does the same way as “FindFirstChildOfClass” T3_MasterGamer 2189 — 2y
0
Thanks for the answer, I'll see if it works! DriBowser 55 — 2y
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? DriBowser 55 — 2y
0
I also tried with the other version. DriBowser 55 — 2y
View all comments (17 more)
0
Oh wait I think something is wrong to your script, I'll edit my answer rq T3_MasterGamer 2189 — 2y
0
It still wont work?? Sorry I keep bugging you lol but ive needed to fix this for a while DriBowser 55 — 2y
0
Do you have a script in your bat tool? Have you used Tool.Activated in your tool? Maybe that’s the problem? T3_MasterGamer 2189 — 2y
0
I won’t get mad if you keep bugging me lol. I just wanted to help people and get my answer accepted. T3_MasterGamer 2189 — 2y
0
oh no, the script is inside of server script service. It happens when i remote event is fired from the bat DriBowser 55 — 2y
0
sorry for the confusion DriBowser 55 — 2y
0
wdym T3_MasterGamer 2189 — 2y
0
can you send me a model of your tool and the script in your serverscriptservice? i might fix it myself T3_MasterGamer 2189 — 2y
0
https://www.roblox.com/library/10117539864/help Heres the model with everything inside DriBowser 55 — 2y
0
Thank you T3_MasterGamer 2189 — 2y
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. T3_MasterGamer 2189 — 2y
0
yes lol DriBowser 55 — 2y
0
just to clarify to use the ability is e, sorry i didnt say before DriBowser 55 — 2y
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. T3_MasterGamer 2189 — 2y
0
No worries, take all the time you need. I understand. DriBowser 55 — 2y
0
Done! I finished the bat tool and I edited the answer. You're welcome! T3_MasterGamer 2189 — 2y
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 DriBowser 55 — 2y
Ad

Answer this question