local localPlayer = game.Players.LocalPlayer --MOVE THIS SCRIPT repeat wait() until…
- User
local localPlayer = game.Players.LocalPlayer
--MOVE THIS SCRIPT
repeat wait() until script.Parent == localPlayer.PlayerGui script.Parent = localPlayer.PlayerScripts
--
local RunService = game["Run Service"] local remove = game.ReplicatedStorage.RemoteEvents.RemoveCollar
local segments = 10 local pull = workspace.Gravity / (20.00611807 * 5) --We're on earth babyyy local width = .1 local attachment0 = script.Attachment0.Value local attachment1 = script.Attachment1.Value local LineSegments = {} local firstLineDrawn = false
function DrawFirstLine(p1,p2,container) local distance = (p1-p2).magnitude local line = Instance.new("Part") line.Name = "LineSegment" line.BrickColor = BrickColor.new("Really black") line.Material = "SmoothPlastic" line.Transparency = 0 line.Anchored = true line.CanCollide = false line.Shape = Enum.PartType.Cylinder line.TopSurface = Enum.SurfaceType.Smooth line.BottomSurface = Enum.SurfaceType.Smooth line.formFactor = Enum.FormFactor.Custom line.Size = Vector3.new(distance,width,width) line.CFrame = CFrame.new(p1,p2)*CFrame.new(0,0,-distance/2)*CFrame.Angles(0,math.rad(90),0) table.insert(LineSegments, line) line.Parent = container end
function UpdateLine(p1, p2, i) local distance = (p1-p2).magnitude LineSegments[i].Size = Vector3.new(distance,width,width) LineSegments[i].CFrame = CFrame.new(p1,p2)*CFrame.new(0,0,-distance/2)*CFrame.Angles(0,math.rad(90),0) end
function DrawCatenary(p1,p2,container) for i=1,segments do local x = ((((i-1)2)/segments)-1) local x2 = (((i2)/segments)-1) if firstLineDrawn then UpdateLine( p1+((p2-p1)/segments*(i-1))+Vector3.new(0,(((math.cosh(x)-1)/(math.cosh(1)-1))-1)pull,0), p1+((p2-p1)/segmentsi)+Vector3.new(0,(((math.cosh(x2)-1)/(math.cosh(1)-1))-1)pull,0), i ) else DrawFirstLine( p1+((p2-p1)/segments(i-1))+Vector3.new(0,(((math.cosh(x)-1)/(math.cosh(1)-1))-1)pull,0), p1+((p2-p1)/segmentsi)+Vector3.new(0,(((math.cosh(x2)-1)/(math.cosh(1)-1))-1)*pull,0), container ) end end firstLineDrawn = true
codelocal p1 = attachment0.WorldPosition local p2 = attachment1.WorldPositionend
remove.OnClientEvent:Connect(function() RemoveRope() end)
local update = RunService.RenderStepped:Connect(function() if attachment0 == nil or attachment1 == nil then RemoveRope() end DrawCatenary(attachment0.WorldPosition, attachment1.WorldPosition, workspace) end)
function RemoveRope() update:Disconnect() for i = 1, segments do LineSegments[i]:Destroy() end script:Destroy() end
if the RemoveRope is called all of the ropes in the game are being deleted instead of only deleting the ropes necessary
- Assistant
- User
okay, there is progress. from the point of view of the person that removes the collar and the person that was collared / collaring, all of the collars in- game are removed. however, this doesn't happen from the point of view of the other players.
- Assistant
- User
local replicatedScripts = {} local JoinReplicateConnection
function StartCurveReplication()
codeJoinReplicateConnection = game.Players.PlayerAdded:Connect(function(player) coroutine.resume(coroutine.create(function() local replicatedCurve = script.DrawLocalLine:Clone() replicatedCurve.Parent = player.PlayerGui table.insert(replicatedScripts, replicatedCurve) replicatedCurve.Disabled = false end)) end) for i, v in game.Players:GetPlayers() do coroutine.resume(coroutine.create(function() local replicatedCurve = script.DrawLocalLine:Clone() replicatedCurve.Parent = v.PlayerGui table.insert(replicatedScripts, replicatedCurve) replicatedCurve.Disabled = false end)) endend
StartCurveReplication()
game.ReplicatedStorage.RemoteEvents.RemoveCollar.OnServerEvent:Connect(function() JoinReplicateConnection:Disconnect() script:Destroy() end)
this is the serverscript our localscript is parented to. is this relevant?
- Assistant
- User
same issue! the ropes of ALL the players are being removed from the client's point of view!
- Assistant