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

Is there a way to make a tool only show up for one player? [closed]

Asked by 8 years ago

I'd like to make a tool that only shows up for one player. So I enter a name and it only shows up for that player.

0
I've got no idea what you mean. You need to give more context User#13152 0 — 8y

Closed as Non-Descriptive by shayner32

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
StoIid 364 Moderation Voter
8 years ago
Edited 8 years ago

I think what you mean is "How do I give a tool to only one player?"

This is a pretty simple feat to accomplish and we can do this by doing this..

Please read my notes carefully to fully understand!

--This is a table to hold the list of players' usernames along with the tool we want to give them
local plrSpecificTools = {
    ["UserName"] = game.ServerStorage:FindFirstChild("Tool") 
}
game.Players.PlayerAdded:connect(function(p) --This is an event that will fire when a player joins our game
    p.CharacterAdded:connect(function(c) --This is another event that will fire when the players character has been added to the Workspace (but not fully loaded) 
    if plrSpecificTools[c.Name] then --Checks to see if the players username is in the table (but also checks if the tool exists) 
        tool = plrSpecificTools[c.Name]:Clone() --Clones the tool
        tool.Parent = game.Players:GetPlayerFromCharacter(c).Backpack --Puts the tool in the players backpack
    end
    end)    
end) 

If you need any help, please comment under my answer.

Ad
Log in to vote
0
Answered by 8 years ago

So if your trying to make a tool only visible to one player, You put the item in the players camera. You need to use welds and such to keep it in places in most terms.

You can put it in the camera using the following:

for i,v in pairs (tool:GetChildren()) do
    v.Parent = game.Workspace.CurrentCamera
end

This line of code has to be placed in a localscript within the client (playergui, starterpack and so on)

You can keep parts welded by using the following

http://wiki.roblox.com/index.php?title=Weld

Something else you might be interested in, well at-least in the future is making somthing visible to anyone besides the player themselves (for example, on phantom forces they use a toned down, less laggy and detailed weapon for other players to view of another player) you can put it within the player's character, this only works in first person as anything on the character becomes transparent. Thats a easy lazy way.

Anyways you want to use welds and put the items in the players camera...