local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local gura = game.Lighting.gura
local copy = gura:Clone()
local toggle = false
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local guraAnim = gura.Anim
local guraAnimTrack = animator:LoadAnimation(guraAnim)
 

local function onInputBegan(input, gameProcessed)
	if not toggle and input.UserInputType == Enum.UserInputType.MouseButton1 then
		copy.Parent = player.Character
		toggle = true
		local kickAnimation = Instance.new("Animation")
		-- Set its "AnimationId" to the corresponding animation asset ID
		kickAnimation.AnimationId = "rbxassetid://6356674028"

		-- Load animation onto the animator
		local kickAnimationTrack = animator:LoadAnimation(kickAnimation)

		-- Play animation track
		kickAnimationTrack:Play()
		local beam = copy:GetDescendants()	
		wait(1.5)
		for index, descendant in pairs(beam) do
			if descendant:IsA("Beam") then
				descendant.Enabled = true
			end	
		end
		local sound = Instance.new("Sound")
		sound.Parent = game.Workspace
		sound.SoundId = "rbxassetid://264084213"
		sound:Play()
		wait(.75)
		for index, descendant in pairs(beam) do
			if descendant:IsA("Beam") then
				descendant.Enabled = false
			end	
		end		
	elseif toggle == true and input.UserInputType == Enum.UserInputType.MouseButton1 then
		toggle = false
		copy.Parent = game.Lighting
	end
end

UserInputService.InputBegan:Connect(onInputBegan) 

I don't believe any thing is fundamentally wrong with the script, but I may be wrong. My problem is that the handle falls through the ground once, but when I reselect it in my toolbar it stays. I've tried plenty of weld scripts and welded all the parts myself to no avail. Any one know what is wrong? Here is the Model as well. https://imgur.com/a/sZk2vcQ

This is 2 gifs of what happens as opposed to a simulation of what is supposed to happen:

https://i.gyazo.com/ff575453fa9999d0a39efb12cc215306.gif https://i.gyazo.com/660606b794a7b08ba017cadf4e7e578c.gif

2 comments

0

is your tool's handle has any weld?

0

Yes.