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

How can I make a model spawner tool?

Asked by 5 years ago

Hello , for my game I really need to make a tool that when clicked , spawns a Model right next to the player (regardless of where the player is on the map , it spawns right next to them). How would I go about doing this? Thank you

0
You could use the `Activated` event of a `Tool` to detect when a player clicks, and use `MoveTo` to have the model move to a position. TheeDeathCaster 2368 — 5y

2 answers

Log in to vote
0
Answered by
Miniller 562 Moderation Voter
5 years ago
Edited 5 years ago

If you have the tool, the decal, everything, and you just need the script, you can do the following: You will need a normal script. Put it at the tool. You can type

--Also, I am not scripting you the events when the player clicks with the tool, etc..
plr = script.Parent.Parent.Parent -- script is in the Tool, tool is in Backpack, backpack is in the player (at game.Players.Player)
isplayer = workspace:FindFirstChild(plr.Name)
if isplayer ~= nil then --Making sure the player's model is in the workspace
    isplr = isplayer:FindFirstChild("Humanoid")
    if isplr ~= nil then -- If 'Humanoid' exist:
        --And there, you can get player's position with the following code:
        pos = isplr.Torso.Position --isplr.Torso.CFrame is also can be used
        --And now you just spawn the model at a little bit away from the player. I am not going to script that for you.
    end
end

I hope I didn't made any mistakes, I didn't tested it because I can't script a tool, but I think that it works. You got the player's position, you can now do anything. I hope this is what you wanted.

0
wow too many comments dude your script is hard to read DeceptiveCaster 3761 — 5y
0
Appreciate the help , thank you:) Enzo341 4 — 5y
0
Enzo341 You are welcome! Miniller 562 — 5y
0
and MCAndRobloxUnited just remove the comments, I am just trying to make him understand this, next time I write less comments :D Miniller 562 — 5y
Ad
Log in to vote
0
Answered by
Galicate 106
5 years ago
Edited 5 years ago

you can use Clone() and MoveTo() to accomplise this local Model = game:GetService("ServerStorage")

local WorkspaceModel = Model:Clone()
WorkspaceModel.Parent = workspace
WorkspaceMode:MoveTo(game.Players.Enzo341.Character.HumanoidRootPart.Position + Vector3.new(0,0,-5))

Answer this question