error message says a part isnt a part of the tool when its clearly is what is going on?
Asked by
4 years ago Edited 4 years ago
so basically whenever I run the code I get the error message of BLADEPART1 is not a valid member of Tool "Players.MrAspuru.Backpack.Anakin's Lightsaber"
I don't understand this as it is clearly a part of the tool I don't know how to add images to this but BLADEPART1 is in the tool
here is the script which is showing the error message
the error message says it's from line 116
001 | attacksequencenumber = 0 |
003 | sound 1 = game.Workspace.Sound 11 |
004 | sound 2 = game.Workspace.Sound 21 |
005 | sound 3 = game.Workspace.Sound 31 |
006 | sound 4 = game.Workspace.Sound 41 |
007 | sound 5 = game.Workspace.Sound 51 |
009 | damagecooldown = false |
010 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
012 | local remoteEvent = ReplicatedStorage:WaitForChild( "Damage" ) |
015 | local playerer = script.Parent.Parent |
020 | local plr = obj.Parent:FindFirstChild( "Humanoid" ) |
022 | if script.Parent.BladeOn.Value = = 1 then |
023 | if enabled = = false then |
026 | remoteEvent:FireServer( "Attack" ) |
036 | tool.Equipped:Connect( function () |
040 | tool.Unequipped:Connect( function () |
045 | script.Parent.Equipped:Connect( function (Mouse) |
046 | Mouse.Button 1 Down:Connect( function () |
048 | animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) |
049 | animation 2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 2 ) |
050 | animation 3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 3 ) |
051 | animation 4 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 4 ) |
052 | animation 5 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 5 ) |
055 | if enabled = = true then |
056 | if script.Parent.BladeOn.Value = = 1 then |
057 | if attacksequencenumber = = 0 then |
061 | if attacksequencenumber = = 1 then |
065 | if attacksequencenumber = = 2 then |
069 | if attacksequencenumber = = 3 then |
073 | if attacksequencenumber = = 4 then |
079 | attacksequencenumber = attacksequencenumber + 1 |
080 | if attacksequencenumber = = 5 then |
081 | attacksequencenumber = 0 |
091 | script.Parent.Unequipped:Connect( function () |
092 | animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) |
093 | animation 2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 2 ) |
094 | animation 3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 3 ) |
095 | animation 4 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 4 ) |
096 | animation 5 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 5 ) |
116 | local part = script.Parent.BLADEPART 1 |
117 | local player = game.Players.LocalPlayer |
119 | local clashsound = game.Workspace.Clash |
122 | local function onPartTouched(otherPart) |
123 | print (part.Name .. " has touched " .. otherPart.Name) |
124 | if otherPart.Name = = "BLADEPART1" and otherPart.ClassName = = "Part" then |
131 | if script.Parent.BladeOn.Value = = 1 then |
137 | part.Touched:Connect(onPartTouched) |
144 | local player = game.Players.LocalPlayer |
145 | local mouse = player:GetMouse() |
151 | mouse.Button 2 Down:connect( function () |
152 | if equipped = = true then |
153 | animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) |
154 | animation 2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 2 ) |
155 | animation 3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 3 ) |
156 | animation 4 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 4 ) |
157 | animation 5 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation 5 ) |
158 | Block = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Block) |
166 | player.Character.Humanoid.WalkSpeed = 8 |
167 | script.Parent.IsBlocking.Value = 1 |
168 | if script.Parent.BladeOn.Value = = 1 then |
174 | mouse.Button 2 Up:connect( function () |
178 | player.Character.Humanoid.WalkSpeed = 16 |
179 | script.Parent.IsBlocking.Value = 0 |
180 | if equipped = = true then |
181 | if script.Parent.BladeOn.Value = = 1 then |
187 | script.Parent.BLADEPART 1. Touched:Connect(damage) |