As part of an upcoming project, I needed to re-write the weapons from Roblox Battle. I did this in 2015, but they had a lot of bugs, and some of the weapons had a noticeable latency. I decided to make these free as of today. All code is free to use, modify, and publish, and comments have also been included if you are trying to learn scripting with existing code.
As a note for R15, I have animations set up, but you will be unable to use them because I can’t make animations public. See: Public Animations.
For now, here is the animations that can be re-uploaded: R15 Animations.rbxm (24.5 KB)
Mind saving (not exporting) them and attaching as an rbxm here? Then other developers can publish those under their account, change the IDs of the tool animations, and then use the animations in their games.
FYI you forgot to disconnect your InputBegan/Ended/Changed events in your tool’s InputHandler module. Replace InputBegan in the module with:
UserInputService.InputBegan:Connect(function(Input,Processed)
print("A") -- just print A whenever we do input
if Processed then return end
local Character = Player.Character
if not Character then return end
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid or Humanoid.Health <= 0 then return end
--Register event if it was a mouse left click.
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
local Position = Get3DPosition(Input.Position.X,Input.Position.Y)
LongInputBeganEvent:Fire(Position)
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
InputBeganEvent:Fire(Position)
end
end
end)
The first time you spawn, it will print A once when you click, the next spawn you spawn, it will print A twice, then 3 times, etc.
This is bad since developers tend to make players spawn with ALL tools at once, so the first time your character spawns, you’re casting 5 rays per click, then 10, then 15…
I have made a change to address this. I need to look into it, but there may be a bug where LocalScripts aren’t properly destroyed when the player respawns.
This looks specific to the idle animation. You could have the wrong id set up for it or uploaded the wrong animation, or the idle animations could just be broken. It isn’t something I can easily resolve unless it is the animation or code being broken which would manifest in Roblox Battle (2018 Edition).
I kinda fixed it myself by modifying the animations, for the holding animation I just set it to loop on 1 keyframe and that worked. I also removed the torso and head keyframes from the other animation and now it looks better.
There is a new bug I encountered where the tool animations work just fine when I test in studio, but then when I publish the game and play it then the animations do not exist in the tools. They are my uploaded animations, I have other R15 animated tools in the game that do not have this problem so I don’t know why it happens like this for these tools. All of the tools are kept inside a folder in ServerStorage. When I put the tools in StarterPack and then publish then it works though.