(to make things a bit clearer, I am making a spiderman game, I need make it so that when I use the swinging method it uses actual physics) I made a swinging tool in my starter pack and attached one local script and one script, this is my script:
script.Parent.Sling.OnServerEvent:Connect(function(player,character,RightHand,part,position,hit,pos)
local distance = (RightHand.CFrame.p - position).magnitude
local Web = Instance.new("Part",workspace)
Web.BrickColor = BrickColor.new("White")
Web.Size = Vector3.new(0.3,0.3,0.3)
Web.Transparency = 1
Web.CanCollide = false
Web.CFrame = CFrame.new(hit.p)
local A1 = Instance.new("Attachment",Web)
local A0 = Instance.new("Attachment",character.RightHand)
A1.Name = "Attachment1"
A0.Name = "Attachment0"
local Rope = Instance.new("RopeConstraint",Web)
Rope.Color = BrickColor.new("White")
Rope.Attachment0 = A0
Rope.Attachment1 = A1
Rope.Visible = true
Rope.Length = 50
wait(0.01)
Web.Anchored = true
local sling = Instance.new("BodyPosition",character.HumanoidRootPart)
sling.Position = hit.p
wait(1.5)
Web:Destroy()
sling:Destroy()
end)
here is my local script
local player = game.Players.LocalPlayer
local Tool = script.Parent
local character = game.Workspace:WaitForChild(player.Name)
local RightHand = character:WaitForChild("RightHand")
local mouse = player:GetMouse()
local Ready = true
Tool.Equipped:Connect(function()
Tool.Activated:Connect(function()
if mouse.Target~=nil then
if Ready == true then
local anim = character.Humanoid:LoadAnimation(script.Parent.Animation)
anim:Play()
Ready = false
local hit = mouse.Hit
local ray = Ray.new(RightHand.CFrame.p,(player:GetMouse().Hit.p - RightHand.CFrame.p).unit*300)
local pos = mouse.Hit.p
local part,position = game.Workspace:FindPartOnRay(ray,player.Character,false,true)
script.Parent.Sling:FireServer(character,RightHand,part,position,hit,pos)
wait(0.5)
Ready = true
anim:Stop()
end
end
end)
end)
I would like it so that my webs attach and ricochet me forward like a pendulum does anyone think this is possible in Roblox studio?
