Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do you make a punching animation button?

Asked by 2 months ago

Heres the punch script just i dont know how you could put this into a button to click and punch:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
punchEvent.Name = "PunchEvent"

local animations = {2837975148, 2837983710}
local function onPunchFired(plr)
    local char = game.Workspace:FindFirstChild(plr.Name)
    local humanoid = char.Humanoid
    local animation = Instance.new("Animation")
    local picked = math.random(1, #animations)
    animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
    local animTrack = humanoid:LoadAnimation(animation)
    animTrack:Play()
    local dmgScript = script.DmgScript:Clone()
    if picked == 1 then
        dmgScript.Parent = char.RightHand
    elseif picked == 2 then
        dmgScript.Parent = char.LeftHand
    end
    dmgScript.Disabled = false
    wait(1.4)
    dmgScript:Destroy()
end

punchEvent.OnServerEvent:Connect(onPunchFired)

0
What do you mean by "button"? ClickDetector? GUI button? "That was easy" button? (That was a joke) and we'd like to see you attempt doing it. I'm assuming its a GUI button, if so you will need remotefunctions/remoteevents. mudathir2007 76 — 2mo
0
ScriptingHelpers is more of a "please give me advice on how to improve" forum, rather than a "please complete this solution for me" forum. User#26471 0 — 2mo
0
Questions like this a lot of times wont get answers, mostly because its bad. Clearly if he cant make this work its because he doesn't understand it. Why should we help you set up your stolen script? DinozCreates 746 — 2mo
0
Whos punching with a GUI button lol. Bad game mechanics 101, i think he just wants it on click. DinozCreates 746 — 2mo
View all comments (6 more)
0
Yeah Gui button like jailbreak?? ChefDevRBLX 34 — 2mo
0
What do you mean whis using a punching button mobile players.. .-. ChefDevRBLX 34 — 2mo
0
because i already got it to work just i need a gui button for mobile players.. ChefDevRBLX 34 — 2mo
0
Why arent you using the mobile buttons, intended for mobile players...? DinozCreates 746 — 2mo
0
I know that but how would I get that script to work so when mobile players hit the button it will punch.? because in computer you hit e to punch. ChefDevRBLX 34 — 2mo
0
HM ChefDevRBLX 34 — 2mo

Answer this question