I was following this tutorial for how to make a spiderman web swinging script and after completing it, I encountered this error:
Webs is not a valid member of Workspace "Workspace" - Client - WebSwingLOCAL:26
(There was no mention within the video to add an object called “Webs” to the Workspace)
(Gotta love it when they don’t have a pastebin in the description to refer to when you encounter errors but rather an inactive discord server on which you can wait like a day or two to receive little to no assistance).
📜🧑Anyways here's the local script which was created
-- Default variables, to be changed based on equipment in usage
-- *Webspeed on server side*
local DEFAULTmaxslingdistance = 150
local DEFAULTmaxzipdistance = 300
local DEFAULTslingcooldown = .5
-- Variables
local uis = game:GetService("UserInputService")
local onweb = false
local onzip = false
local onshoot = false
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local Camera = workspace.CurrentCamera
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local tween = game:GetService("TweenService"):Create(Camera, TweenInfo.new(.4), {FieldOfView = 100})
local tween2 = game:GetService("TweenService"):Create(Camera, TweenInfo.new(.6), {FieldOfView = 70})
local webzipkeycode = Enum.KeyCode.E
local webshootkeycode = Enum.KeyCode.Q
mouse.TargetFilter = workspace.Webs
local Mechanics = game:GetService("ReplicatedStorage"):WaitForChild("Mechanics")
-- Factor in values from equipment
local Equipped = plr:WaitForChild("Equipped"):WaitForChild("1")
-- slingforce done on serverscript
local maxslingdistance = DEFAULTmaxslingdistance * Equipped:FindFirstChildWhichIsA("StringValue").Value2
local maxzipdistance = DEFAULTmaxzipdistance * Equipped:FindFirstChildWhichIsA("StringValue").Value2
local slingcooldown = DEFAULTslingcooldown * Equipped:FindFirstChildWhichIsA("StringValue").Value3
-- mouse.Icon = ""
uis.InputBegan:Connect(function(i, g)
if i.UserInputType == Enum.UserInputType.MouseButton1 and not g then
local mpos = mouse.Hit.Position
if (mpos - char.HumanoidRootPart.Position).Magnitude > maxslingdistance then
return
end
if onweb == false then
onweb = true
tween:Play()
if mouse.X > mouse.ViewSizeX / 2 then
Mechanics.Web:FireServer(true, mouse.Target, mpos, "Right")
hum.PlatformStand = true
else
Mechanics.Web:FireServer(true, mouse.Target, mpos, "Left")
hum.PlatformStand = true
end
end
end
end)
uis.InputEnded:Connect(function(i, g)
if i .UserInputType == Enum.UserInputType.MouseButton1 and not g then
if onweb == true then
onweb = false
tween2:Play()
Mechanics.Web:FireServer(false)
hum.PlatformStand = false
end
end
end)
NOTE I did make a few derivations from the script shown in the video (although I don’t believe these derivations would nor should lead to any bugs)
📜🌐Here's the server script as well:
rope.Length = length
rope.Color = BrickColor.new("White")
rope.Restitution = 0.5
task.wait()
local fakeattach = Instance.new("Attachment")
fakeattach.Parent = target
fakeattach.WorldPosition = char[hand.."Hand"].Position
local fakeattach2 = Instance.new("Attachment")
fakeattach2.Parent = target
fakeattach2.WorldPosition = char[hand.."Hand"].Position
local beam = Instance.new("Beam")
beam.Texture = "rbxassetid://8599205743"
beam.TextureMode = Enum.TextureMode.Stretch
beam.TextureSpeed = 0
beam.TextureLength = 0.1
beam.Transparency = NumberSequence.new(0)
beam.LightEmission = 1
beam.LightInfluence = 0
beam.FaceCamera = true
beam.Attachment0 = fakeattach2
beam.Attachment1 = fakeattach
beam.Width0 = 3
beam.Width1 = 3
beam.Parent = arm
local bodyforce = Instance.new("BodyForce")
bodyforce.Parent = char.HumanoidRootPart
local animator = char.Humanoid:WaitForChild("Animator")
local spider = animator:LoadAnimation(script:WaitForChild("Spider"))
spawn(function()
statuses[plr] = {armattachment, pointattachment, fakeattach, rope, bodyforce, bodygyro, beam}
local tween = tweens:Create(fakeattach, TweenInfo.new(webreachspeed), {WorldPosition = point})
tween:Play()
tween.Completed:Connect(function()
beam.Attachment1 = pointattachment
end)
while true do
if char.Humanoid then
if statuses[plr] ~= nil then
spider:Play()
bodygyro.CFrame = CFrame.new(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position + char.Humanoid.MoveDirection * 10)
bodyforce.Force = Vector3.new(char.Humanoid.MoveDirection.X * webslingspeed, -webslingspeed / 10, webslingspeed / 5)
else
spider:Stop()
tween:Cancel()
break
end
else
spider:Stop()
tween:Cancel()
break
end
task.wait()
end
end)
end
elseif status == false then
if statuses[plr] ~= nil then
for _, v in pairs(statuses[plr]) do
v:Destroy()
end
statuses[plr] = nil
end
end
end)
Could someone please help me determine what to do about the whole “Webs isn’t a valid member” error and if they note any other errors within the code correct them for me?
Thank you.