Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Cloning parts into players? [STILL UNANSWERED]

Asked by 9 years ago

Hello scripting helpers,

I just created a tool giver script, it doesn't work. The script works fine without the 4th line. The script gives the tools flawlessly.

What it's supposed to do is check if the player is in the group and is in the role 12 or higher. If so, it gives them the tools and parts. The WalkeeTalkee is a small red part what should go inside the players head. When I run the script, it gives me the 4 tools fine but the WalkeeTalkee duplicates next to the part in the workspace.

These are the descriptions:-

WalkeeTalkee -- Part
Taser -- Tool
HR Radio -- Tool 
HR Gun -- Tool
Card -- Tool

Then the script:-

game.Players.PlayerAdded:connect(function(p) -- Works fine
p.CharacterAdded:connect(function(pp) -- NEED HELP
        if tonumber(p:GetRankInGroup(1240173)) >= 12 then -- Works fine
            game.Workspace.WalkeeTalkee:Clone().Parent = pp.Head -- NEED HELP
            game.ServerStorage.HRTools.Taser:Clone().Parent = p.Backpack  -- Works fine
            game.ServerStorage.HRTools["HR Radio"]:Clone().Parent = p.Backpack -- Works fine
            game.ServerStorage.HRTools["HR Gun"]:Clone().Parent = p.Backpack -- Works fine
            game.ServerStorage.HRTools.Card:Clone().Parent = p.Backpack -- Works fine
        end
    end)
end)

Hope you help! :] Nathan.

0
http://wiki.roblox.com/index.php?title=CFrame It's another version of changing the part's position, EXCEPT, It can clip into other parts and you can also change the camera's position EzraNehemiah_TF2 3552 — 9y
0
I just tried to do that, I can't figure it out. I also tried walkeetalkee.Position = pp.Head.Position on line 20 but I get: ServerScriptService.HRTools:20: bad argument #3 to 'CFrame' (CFrame expected, got userdata) I never can understand CFrame. WelpNathan 307 — 9y
0
Think of CFrame as two Vector3's, one Vector3 being the Position and the other being the Rotation. And to get the Position from the CFrame, you do `CFrame.p`, with CFrame in my example being your CFrame. Diitto 230 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

The only thing wrong is the WalkeeTalkee. You need to make the walkeetalkee have a weld and make joints. After that you need to change the CFrame of the part to the head so the walkeetalkee isn't floating anywhere.

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(pp) -- This is fine
        if tonumber(p:GetRankInGroup(1240173)) >= 12 then
            local walkeetalkee = game.Workspace.WalkeeTalkee:Clone()
            walkeetalkee.Parent = pp.Head
        walkeetalkee.CFrame = CFrame.new(pp.Position) --EDIT THIS
        pp:MakeJoints()--Make joints so it sticks. Make the walkeetalkee have a weld.
            game.ServerStorage.HRTools.Taser:Clone().Parent = p.Backpack
            game.ServerStorage.HRTools["HR Radio"]:Clone().Parent = p.Backpack
            game.ServerStorage.HRTools["HR Gun"]:Clone().Parent = p.Backpack
            game.ServerStorage.HRTools.Card:Clone().Parent = p.Backpack
        end
    end)
end)

Hope it helps!

0
Thanks for taking your time to help. However, I don't know what you mean by changing the CFrame of the part to the head. WelpNathan 307 — 9y
Ad

Answer this question