I’m looking to make a pendulum based swinging script for a spider-man game im working on. How would I go about that. I’ve tried several times with different scripts but just can’t get it to work. Could anyone help me script one?
1 Like
you could try using a rope constraint. It requires a bit of scripting but it shouldnt be that hard
--Raycast, get the info
local RayResult = Ray.New(handPosition, (MousePosition - handPosition))
--Create attachment at the hit point
if rayResult and rayResult.Instance then
local HitPosition = rayResult.Position
local HitObject = rayResult.Instance
local Attachment = Instance.new("Attachment", hitObject)
Attachment.Position = (HitPosition - HitObject.Position)
local Rope = Instance.new("RopeConstraint")
Rope.Attachment0 = Attachment
Rope.Attachment1 = --Put attachment in tool that the rope connects to
Rope.Length = (Attachment0 - Attachment1).magnitude
Rope.Color = --Put color name you want here ex("Dark Stone Grey")
Rope.Visible = --Do you want to see the rope
Rope.Thickness = --How thick do you want the rope
Rope.Parent = --Somewhere in workspace
end
it might not work copy paste because I haven’t tested it, but this is the general idea
You could hook it up with a remote event or just have it on the client (so its lag free)
2 Likes