.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
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?
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).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.