Need help with rope system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make it so that when there are 2 players in the capsule thing, the rope gets welded to them.

  2. What is the issue? Include screenshots / videos if possible!
    unable to assign property Value. Instance expected, got string

  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    everything
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local prompt = script.Parent
local part = prompt.Parent
local teleport = script.Parent.Parent.Parent.Teleport
local player1 = prompt.Player1
local playerName = prompt.PlayerName
local playerName2 = script.Parent.Parent.Parent.Parent.first.prompt.ProximityPrompt.PlayerName

prompt.Triggered:Connect(function(player)
	part.Transparency = 1
	local character = player.Character
	if character then
		character:MoveTo(teleport.Position)
		prompt.Enabled = false
		player1.Value = true
		playerName.Value = player.Name
		character:WaitForChild("Humanoid").Died:Connect(function()
			playerName.Value = ""
			wait(2)
			player1.Value = false
			prompt.Enabled = true
		end)
	end
end)

-- 2nd script
local prompt = script.Parent
local part = prompt.Parent
local teleport = script.Parent.Parent.Parent.Teleport
local player1 = prompt.Player2
local playerName = prompt.PlayerName
local playerName2 = script.Parent.Parent.Parent.Parent.second.prompt.ProximityPrompt.PlayerName
prompt.Triggered:Connect(function(player)
	part.Transparency = 1
	local character = player.Character
	if character then
		character:MoveTo(teleport.Position)
		prompt.Enabled = false
		player1.Value = true
		playerName.Value = player.Name
		character:WaitForChild("Humanoid").Died:Connect(function()
			playerName.Value = ""
			wait(2)
			player1.Value = false
			prompt.Enabled = true
		end)
	end
end)

-3rd script
local players = game.Players.LocalPlayer
local character = script.Parent
local playerValue = script.PlayerValue

local runService = game:GetService("RunService")

local vectorForce = Instance.new("VectorForce")
vectorForce.Parent = character.HumanoidRootPart
vectorForce.Attachment0 = character.HumanoidRootPart.RootAttachment
vectorForce.Force = Vector3.new(0,0,0)
vectorForce.ApplyAtCenterOfMass = true

local beam = script.Beam
beam.Parent = character.HumanoidRootPart
beam.Attachment0 = character.HumanoidRootPart.RootAttachment

local maxRange = 15
local strength = 5


function getMass(model)
	assert(model and model:IsA("Model"), "Model argument of getMass must be a model")
	local mass = 0
	for i, v in pairs(model:GetDescendants()) do
		if (v:IsA("BasePart")) then
			mass += v:GetMass()
		end
	end
	mass = mass * workspace.Gravity
	return mass
end

playerValue.Changed:Connect(function()
	if playerValue.Value then
		beam.Attachment1 = playerValue.Value.HumanoidRootPart.RootAttachment
		runService.Heartbeat:Connect(function()
			local distance = (character.HumanoidRootPart.Position - playerValue.Value.HumanoidRootPart.Position).Magnitude
			local direction = (playerValue.Value.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Unit
			local localDirection = character.HumanoidRootPart.CFrame:VectorToObjectSpace(direction)
			
			if distance > maxRange then
				local state = character.Humanoid:GetState()
				if state == Enum.HumanoidStateType.Freefall then
					local forceMagnitude = getMass(character) + (distance * strength)
					local finalForce = localDirection * forceMagnitude
					vectorForce.Force = finalForce
				else
					local forceMagnitude = getMass(character) + (distance * (strength * 50))
					local finalForce = localDirection * forceMagnitude
					vectorForce.Force = finalForce
				end
			else
				vectorForce.Force = Vector3.new(0,0,0)
			end
		end)
	end

(i used an object value for those btw)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

What line is the error at? It would help to know.

I’m assuming playerName and playerName2 are ObjectValues, but you’re setting them to strings like player.Name. If you want to store the player’s name as text, you should use StringValues instead.

However, if you still want to use ObjectValues, you should assign the player instance like this:
objectValue.Value = player

1 Like

Seeing many logic errors… I’ll send you a PM.

i tried to use string values but the object value under the 3rd script will not work like that

so should i make all of them string values?

You should use ObjectValues and set their Value to the player instance, rather than storing the player’s name as a string.

Also, in the third script, I’m not sure what playerValue is used for. Based on how it’s being used, it seems like it’s supposed to reference a character. If that’s the case, you’ll need to make sure playerValue.Value is actually being set to the player’s character, not the player or just their name.

alr ty for ur help ill try it soon when i can

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.