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

How to spawn an object?

Asked by 4 years ago

How would I make a platform which spawns an an-anchored ball and disappear when the ball reaches a certain area or if the player dies? Also, how would I make it only appear for that one player so if another player is there they can`t interact with that ball.

0
tl;dr for that answer, local a = Instance.new("Part",workspace") a.Shape = "Ball" localscript startergui greatneil80 2647 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

To spawn an object, it is created with the new function from the Instance class. It takes in a class name for the instance to be created. In this case, you could do "Part" as it is your desired class to be made.

You then must modify the properties of your new part to your liking and parent it to workspace as it is by default not existing physically until modified to be.

local part = Instance.new("Part")

If you want to make it only appear for one player, simply create the part only in the client via a local script. If you're from the server, you'll utilize remote events/functions to do this as they can communicate to the client.

This is all the help I am giving as you must attempt the rest as you should attempt your problem as it wouldn't be any effort if you got a straight answer to that broad request.

0
Thanks! Sorry for the broad request, but I'll try NightWarrior1717 14 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

to create an object you can use instance.new for example:

local hi = instance.new("part",workspace)

hi.Name = "Awesome"

in hi you can put the name you want.

I put part because I want to create a part obviously.

I put workspace since I want that part to be created in the workspace

in the third line he changed the name to the part

first I put the name that was hello and then I put the name that I want it to be assigned which in the example was Awesome.

now I'm going to create a model so that a part is created inside

local hi = instance.new("model",workspace)

hi.Name = "Awesome"

local hi2 = instance.new("part",game.workspace.Awesome)

hi2.Name = "hotdog"

what this does is create a model in the workspace.

then he names it Awesome.

now create a part in Awesome since that's what the model is called

and then name the part with the name of hotdog.

Answer this question