Ad
Log in to vote
0

I can't Parent Other Player's Weapons Into Mine with Mouse?

Asked by
EEnergy8 266 Moderation Voter
1 month ago

Hey, It's been awhile since i last scripted and im abit lost. What I'm trying to do is when I point at a character, the Weapons that they have, should Transfer to my character.

The Character im pointing has already a Weapons Folder with Tools in the folder. I get the Print "Found Target" even when I point at the baseplate though, but I get the error that it dosen't have a folder named "Weapons"

Also, when i Point at a character, I get the print "Found Target" and the "Remote Event Fired From Server" but the tools don't get parented into my character, no errors.

Thanks!

Sever

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(localPlayer, Target)
    Target.Weapons:GetChildren().Parent = localPlayer.Character
    print("Remote Event Fired from Server")
end)

Local

local Mouse = game.Players.LocalPlayer:GetMouse()

while wait(1) do
    if Mouse.Target then
        if Mouse.Target.Parent:FindFirstChild("Humanoid") then
            print("Found target")
            game.ReplicatedStorage.RemoteEvent:FireServer(Mouse.Target.Parent)
                else
        print("No Target")
        end

    end
end
1
:GetChildren() returns a table, you'd need to loop through that and then parent the tools in the loop. the8bitdude11 358 — 1mo

Answer this question