Hi , i need effect of spawn on part like it spawns on top but like always on top no matter how high postion is it will be always down on the floor
Do you mean if the part or player is added where the spawn Part is they don’t stack up, or do you mean that your parts are spawning above your spawn Part?
Not sure what exactly your question is, but I’m assuming your goal is spawning an object always on-top of any object at any height.
You can pull this off with a simple script like this:
local spawnPart = game.Workspace.SpawnPart
local halfSpawnPart = spawnPart.Size.Y/2
local floorPart = game.Workspace.Floor
local halfFloor = floorPart.Size.Y/2
local X = ... --Position of your choice
local Y = floorPart.Position.Y + halfFloor + halfSpawnPart
local Z = ... --Position of your choice
spawnPart.Position = Vector3.new(X,Y,Z)
Before:
After:
Hope this helps!
uh image game for example piggy i want the trap to spawn below moster but not in mid air
yea but my models will be to big and advanced to do that manually …
Just use CFrames!
When your model is finished and welded, find the lowest part on the Y axis (or make a custom one, and make it transparent with CanCollide
disabled) and set that part to the PrimaryPart of the model.
In the script, changing the position of the model would look something like this:
model.PrimaryPart.CFrame = CFrame.new(X,Y,Z)
but when player will jump part will be mid air
That portion of the script is up to you, and how your game works…
There are plenty of resources on a plethora of things in Roblox scripting. Mainly YouTube and the Dev Forum will be your best sources of information.
For a push in the right direction, think of a way to get the current floor that is below the player. This could be done with raycasting, or even the touched event. (I suggest using raycasts)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.