I Put the tool in the starter pack and I wanted to make the Local script only work when the tool is selected. The local script I have is for a wave of water. What Do I have to do add a Handle?
local enabled = true
Player = script.Parent.Parent
--Player:WaitForDataReady()
mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
if not enabled then return end
enabled = false
Key = key:lower()
if key == "x" then
RightShoulder = Player.Character.Torso["Right Shoulder"]
LeftShoulder = Player.Character.Torso["Left Shoulder"]
Run = game:GetService("RunService")
for i = 1, 2 do
for i = 1, 12 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0.1, 0)
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, -0.1, 0)
Run.Stepped:wait(0.01)
end
for i = 1, 12 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0.1, 0)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0.1, 0)
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
Run.Stepped:wait(0.005)
end
end
for i = 1, 12 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0.1, 0)
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, -0.1, 0)
Run.Stepped:wait(0.005)
end
game:GetService("Chat"):Chat(Player.Character.Head, "Water Style: Water Wave Jutsu")
x = Instance.new("Part")
x.BrickColor = BrickColor.new("Really Blue")
x.Size = Vector3.new(15, 10, 2)
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Block"
x.Name = Player.Name
x.CanCollide = true
x.Transparency = 0.1
fd = script.Waterdamage:clone()
fd.Parent = x
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent = x
f = Instance.new("Fire", x)
f.Size = 15
f.Heat = 0
x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -6)
fd.Disabled = false
game.Debris:AddItem(x, 6)
wait(0.25)
for i = 1, 12 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0.1, 0)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0.1, 0)
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.16)
RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
Run.Stepped:wait(0.01)
end
end
wait(0)
enabled = true
end
mouse.KeyDown:connect(onKeyDown)

1 comment
You can't use a tool in Roblox studio because you do not have a character.