I’m trying to make a Spiderman Web-Swinging System but nothing is working. I press E to swing, but absolutely nothing happens other than the instances being put into the workspace.
I set my rope to visible, but its not visible.
I made a body force on the player’s character, my character is not moving.
All the instances I’ve created to make this though have all worked and instanced into the workspace or their proper parent.
I also become a noob, I don’t know why.
Main code that's not working
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local WebCounter = {}
local PlayerInstances = {}
local function count(player)
if not WebCounter[player] then
WebCounter[player] = 0
elseif WebCounter[player] == 0 then
WebCounter[player] = 1
elseif WebCounter[player] == 1 then
WebCounter[player] = 0
end
end
local function tracker()
local part = Instance.new("Part")
part.Transparency = 1
part.CanCollide = false
part.Anchored = true
part.Parent = workspace
return part
end
local function web(part)
local rope = Instance.new("RopeConstraint")
local attach1 = Instance.new("Attachment")
attach1.Parent = part
rope.Attachment1 = attach1
rope.Length = 50
rope.Thickness = 0.25
rope.Visible = true
return rope,attach1
end
local function parts(character)
local part = tracker()
local rope = web(part)
print(part,rope)
return part,rope
end
ReplicatedStorage.Web.OnServerEvent:Connect(function(player,signal)
local character = player.Character
local root = character.HumanoidRootPart
local rightArm = character:FindFirstChild("Right Arm")
local leftArm = character:FindFirstChild("Left Arm")
if signal == "Swing" then
local part,rope,attach1 = parts(character)
count(player)
print(rope.Visible)
if WebCounter[player] == 0 then
rope.Attachment1 = leftArm.LeftGripAttachment
rope.Parent = leftArm
part.Position = root.Position + Vector3.new(20,20,-50)
elseif WebCounter[player] == 1 then
rope.Attachment1 = rightArm.RightGripAttachment
rope.Parent = rightArm
part.Position = root.Position + Vector3.new(-20,20,-50)
end
PlayerInstances[player] = {part,rope,attach1}
elseif signal == "Release" then
for i,v in ipairs(PlayerInstances[player]) do
v:Destroy()
if v ~= nil then v = nil end
end
end
end)
This is on the client:
local function force()
print('Force')
local bf = Instance.new("BodyForce")
bf.Force = (Root.CFrame.LookVector * 1000) + (Root.CFrame.UpVector * 200)
bf.Parent = Root
return bf
end