I'm trying to make a distance cap for my grapple script and I'm stuck
The script
local UIS = game:GetService("UserInputService")
local hum = script.Parent.Parent.Humanoid
local char = script.Parent.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local gt = Instance.new("Animation")
gt.Name = "GrappleThrow"
gt.AnimationId = "rbxassetid://MyAnimId"
local gp = Instance.new("Animation")
gp.Name = "GrapplePull"
gp.AnimationId = "rbxassetid://MyAnimId"
local gt1 = hum:LoadAnimation(gt)
local gp1 = hum:LoadAnimation(gp)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
if mouse.Target and script.cooldown.Value == false then
if mouse.Target.Name == "GrapplePoint" then
local mod = mouse.Target
script.Parent.GrappleEvent:FireServer(mod)
gt1:Play()
wait(0.4)
gp1:Play()
wait(0.4)
end
end
end
end)

1 comment
Thank you, This worked very well!