How do I do this?

Can you show me the script please ?

The FULL script.

3 Likes

That’s the problem i was wondering how would i be able to do this?

1 Like

when i played with swinging i ended up using springs not ropes because it allowed me to slowly shorten the spring to bring the player up into the air

here is a demo place that uses springs
https://www.roblox.com/games/8701115401

the next thing your going to need is where does the spring or rope connect to

this can be a fixed points that you place around the world or where the player clicks or a mixture of both

while the player is swinging its important that the humanoids HumanoidStateType is physics or the character will not swing nicely

if you tell me what you want the spring to connect to i can tell you step by step what you need to do

2 Likes

How would i do that currently i used a beam i cannot provide any scripts as i cannot access my account at the moment but here’s what i have made
https://www.roblox.com/games/9608576194/Web-swinging

i’m currently on a Linux laptop so i cant play the game but if you describe to me how you want the rope/sprint to connect ill help you

is this what you currently have done or is this what your trying to do?

1 Like

I’ve already made my mechanics
example video of them:


I already made the mechanics but i want to change them completely As i said before i want the same results as the one i linked in the post
Feedback on Web Swinging thingy - #9 by alexsany
I want the same results

I may be offline for a while in about 5 minutes so if you could just write the whole explanation in a post that would be appreciated!

OK so if you want to change them completely

lets first make the targeting system

  1. make a new baseplate project
  2. create a folder in workspace called “Attachments”
  3. place some red anchored parts inside this folder and move them around the world
  4. place a BillboardGui with a target ImageLabel in starter gui
  5. create a localscript and for now lets put this script inside StarterCharacterScripts and get a reference to the BillboardGui
  6. we will then set the BillboardGui.Adornee so it shows us what part is targeted
-- localscript in StarterCharacterScripts
local runService = game:GetService("RunService")
local character = script.Parent
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
local billboardGui = game.Players.LocalPlayer:WaitForChild("PlayerGui").BillboardGui
local attachmentParts = workspace.Attachments:GetChildren()
local maxSwingRange = 100

-- every frame call this function
runService.Heartbeat:Connect(function(deltaTime)
	local selectedPart = nil
	local selectedMagnitude = math.huge
	-- loop all children inside the Attachments folder
	for i, child in ipairs(attachmentParts) do
		-- get the distance from the character
		local magnitude = (child.Position - rootPart.Position).Magnitude
		-- if we already have a closer selected part then skip
		if magnitude > selectedMagnitude then continue end
		-- if the part is outside are max range then skip
		if magnitude > maxSwingRange then continue end
		-- get where this part is in are camera view
		local viewVector, inView = camera:WorldToViewportPoint(child.Position)
		-- if the part is not in are camera view then skip
		if inView == false then continue end
		-- all checks have past this is are new selected part
		selectedPart = child
		selectedMagnitude = magnitude
	end
	-- update the adornee to the new selected part
	billboardGui.Adornee = selectedPart
end)
2 Likes

Go on what should i do next? –

do you have the target system working now and are you happy how it targets them?

if you send a short video it will help me see how its working

also try to understand what the code is doing

1 Like

I’m not home right now but il test it when i get back

OK once you have finished this part then we will continue

1 Like

Okay so i added everything you listed what should i do next?

ok so lets change it so that other scripts can access the target

inside replicatedStorage make a new ObjectValue and lets call it Target

and lets change are scripts so it works like this

-- localscript in StarterCharacterScripts
local runService = game:GetService("RunService")
local character = script.Parent
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
local targetValue = game.ReplicatedStorage:WaitForChild("Target")
local attachmentParts = workspace:WaitForChild("Attachments"):GetChildren()
local maxSwingRange = 100

runService.Heartbeat:Connect(function(deltaTime)
	local selectedPart = nil
	local selectedMagnitude = math.huge
	for i, child in ipairs(attachmentParts) do
		local magnitude = (child.Position - rootPart.Position).Magnitude
		if magnitude > selectedMagnitude then continue end
		if magnitude > maxSwingRange then continue end
		local viewVector, inView = camera:WorldToViewportPoint(child.Position)
		if inView == false then continue end
		selectedPart = child
		selectedMagnitude = magnitude
	end
	targetValue.Value = selectedPart
end)
-- localscript inside StarterPlayerScripts
local billboardGui = game.Players.LocalPlayer:WaitForChild("PlayerGui").BillboardGui
local targetValue = game.ReplicatedStorage:WaitForChild("Target")

targetValue.Changed:Connect(function(value)
	billboardGui.Adornee = value
end)
1 Like

Okay and what should i next??–

can you show me what you have so far

1 Like



I really appreciate you helping me by the way :+1:

and so far its all working with no errors? when you play the game

you can rename the local scripts to something like Billboard and TargetSelector

so next lets make a part and a spring and attachment
put the part in replicatedstorage
and put a attachment inside this part
and also put a spring inside this part
and set spring.Attachment1 = attachment
in StarterCharacterScripts let make a new localscript

-- localscript inside StarterCharacterScripts
local userInputService = game:GetService("UserInputService")
local character = script.Parent
local rootPart = character:WaitForChild("HumanoidRootPart")
local targetValue = game.ReplicatedStorage:WaitForChild("Target")
local springPart = game.ReplicatedStorage:WaitForChild("SpringPart")
local spring = springPart:WaitForChild("Spring")

-- make a new attachment for the character
local attachment = Instance.new("Attachment")
attachment.Position = Vector3.new(0, 10, 0)
attachment.Parent = rootPart

-- attach the spring to the attachment
spring.Attachment0 = arrachment

-- move the spring part into workspace
springPart.Parent = workspace

userInputService.InputBegan:Connect(function(input, processed)
	if processed == true then return end
	if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end
	if targetValue.Value == nil then return end
	-- when the player clicks mouse 1 move the spring part to the targets cframe
	springPart.CFrame = targetValue.Value
end)
1 Like


How do i fix this?

I’m not familiar with this so how would i fix this?