I have a local script that activates a server script inside of itself using a remote event then Replicates apart from the Replicated storage and welds it to the player's hand and when it is touched by a humanoid it prints something but it keeps giving me an error like this "attempt to index nil with 'Touched'"
here is the entire server script:
Damage = 50
Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4952995121"
script.Parent.First.OnServerEvent:Connect(function(Player)
local Rasengan = game.ReplicatedStorage.Rasengan
RasenClone = Rasengan:Clone()
RasenClone.Parent = workspace
RasenClone.CanCollide = false
playanim = Player.Character.Humanoid:LoadAnimation(Animation)
playanim:Play()
RasenClone.Anchored = false
local weld = Instance.new("Weld", RasenClone)
weld.Part1 = RasenClone
weld.Part0 = Player.Character.RightHand
weld.C0 = CFrame.new(0, -1.5, 0)
for i = 1, 28 do
RasenClone.Size = RasenClone.Size + Vector3.new(0.05, 0.05, 0.05)
wait(0.1)
end
MainPart = RasenClone
MainPlayer = Player
end)
script.Parent.Second.OnServerEvent:Connect(function(player, Damage)
MainPart:Destroy()
playanim:Stop()
end)
RasenClone.Touched:Connect(function(hit)
if hit.Parent.Humanoid then
MainPlayer.Character.Humanoid.WalkSpeed = MainPlayer.Character.Humanoid.WalkSpeed-16
RasenClone:Destroy()
end
end)
Thank You in advance

1 comment
It still says "attempt to index nil with 'Touched'"