I wanted local script to be in a tool

.I wanted local script to be a tool. sometimes you see free models but without tools to apply the local script. How do I make localscript and put it in tool but it works

image_2021-08-07_195955

Do you need to put the local script in the tool?

That’s actually impossible. You can’t make a Local Script tool.

Yea and script it like when I press button I it work but when i unuse the tool it not work the loclscript

If you want the tool to work with the script then put the script in the tool. A script can not be used as a tool unless it is the child of a tool.

Drag the script into the tool, for a start. If your script needs some other things, you might need to make some adjustments to the properties of the tool or add things into the tool.

should I add it to the script so it starts working

local Tool = script.Parent

Tool.Equipped:Connect(function()

Tool.Equip.Value = true

end)

Tool.Unequipped:Connect(function()

Tool.Equip.Value = false

end)

can you send what’s in the script?

1 Like

local UIS = game:GetService(“UserInputService”)

local Remote = script:WaitForChild(“Remote”)

Remote:FireServer()

local camera = workspace.CurrentCamera
local DKeyDown = false
local SKeyDown = false
local AKeyDown = false
local WKeyDown = false

local CameraShaker = require(game:GetService(‘ReplicatedStorage’):WaitForChild(“CameraShaker”));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)

local Blocking = false

camShake:Start()

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
while Char.Parent == nil do
Char.AncestryChanged:wait()
end
local HumRP = Char:WaitForChild(“HumanoidRootPart”)
local Hum = Char:WaitForChild(“Humanoid”)
local RollFrontAnim = Hum:LoadAnimation(script:WaitForChild(“RollFront”))
local BackRollAnim = Hum:LoadAnimation(script:WaitForChild(“BackRoll”))
local LeftRollAnim = Hum:LoadAnimation(script:WaitForChild(“RightRoll”))
local RightRollAnim = Hum:LoadAnimation(script:WaitForChild(“LeftRoll”))
local DashDebounce = false
local DashingDebounce = false

local CanDoAnything = true

UIS.InputBegan:Connect(function(Input,IsTyping)
if IsTyping then return end

if CanDoAnything == true then
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		Remote:FireServer("Slash")	
		
	elseif Input.KeyCode == Enum.KeyCode.One then
		Remote:FireServer("Equip")	
	elseif Input.KeyCode == Enum.KeyCode.One then
		if DashDebounce == false and Char:FindFirstChild("Disabled") == nil then
			DashDebounce = true
			CanDoAnything = false
			delay(0.3,function()
				CanDoAnything = true
			end)
			delay(0.8,function()
				DashDebounce = false
			end)
			if WKeyDown then
				RollFrontAnim:Play()
				DashingDebounce = true
				
				delay(0.25,function()
					DashingDebounce = false
				end)
				
				repeat
					HumRP.Velocity = HumRP.CFrame.lookVector * 70
					wait(0.05)
				until DashingDebounce == false
			elseif SKeyDown then
				DashingDebounce = true
				
				BackRollAnim:Play()
				
				delay(0.25,function()
					DashingDebounce = false
				end)

				repeat
					HumRP.Velocity = HumRP.CFrame.lookVector * -70
					wait(0.05)
				until DashingDebounce == false
			elseif DKeyDown then
				DashingDebounce = true
				
				RightRollAnim:Play()
				
				delay(0.25,function()
					DashingDebounce = false
				end)

				repeat
					HumRP.Velocity = HumRP.CFrame.rightVector * 70
					wait(0.05)
				until DashingDebounce == false
			elseif AKeyDown then
				DashingDebounce = true
				
				LeftRollAnim:Play()
				
				delay(0.25,function()
					DashingDebounce = false
				end)

				repeat
					HumRP.Velocity = HumRP.CFrame.rightVector * -70
					wait(0.05)
				until DashingDebounce == false
			end	
		end	
		
	elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
		if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
			Remote:FireServer("Heavy")
		end
	end
end	

end)

local RunService = game:GetService(“RunService”)

RunService.RenderStepped:Connect(function()
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Hum = Char:FindFirstChild(“Humanoid”)

if UIS:IsKeyDown(Enum.KeyCode.F) then
	if CanDoAnything == true then
		if Blocking == false then
			Blocking = true
			Remote:FireServer("Block",true)
		end	
	end	
else
	if Blocking == true then
		Blocking = false
		Remote:FireServer("Block",false)
	end
end

-- Yessir

end)

Remote.OnClientEvent:Connect(function(Action)
if Action == “HeavyShake” then
camShake:Shake(CameraShaker.Presets.HeavyHit)
else
camShake:Shake(CameraShaker.Presets.SwordHit)
end
end)

You can. LocalScripts work in tools (as long as the tool is owned by a player)

Thread’s a little unclear; are you trying to make your code work without a tool? Just code it like a regular tool. You will have to handle equip logic yourself though, such as determining when it would be appropriate to active your tool’s code (and likewise the server should determine when it’s appropriate to commit any actions requested by the client for said tool).

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.