# Prop Spawner

**URL:** <https://forums.unrealengine.com/t/prop-spawner/2342833>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 18, 2025, 7:08pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833 "2025-02-18T19:08:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexisabanana](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexisabanana](https://forums.unrealengine.com/u/alexisabanana)\
**Post date:** [February 18, 2025, 7:08pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/1 "2025-02-18T19:08:30Z")

</div>

Hey all,

Hope everyone is having a good day. I’m trying to create a prop spawner that will randomly spawn a prop in one of three locations and i’m having issues. I’m quite new to UEFN and Verse.

I’m not the best programmer out there. Previously experience being HTML and Javascript.

This is my code for the script

```auto
  
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath}
using { /Verse.org/Random }

# A Verse-authored creative device that can be placed in a level
Tape_spawner := class(creative_device):

    @editable
    tapeProp: creative_prop = creative_prop{}

    @editable
    tapeAsset : creative_prop_asset = DefaultCreativePropAsset
    

        
    TapeLocationDecider():void=    
        var RandomInt:int = GetRandomInt(1,3)
         if (RandomInt = 1):
             tapelocation:vector3 = vector3{X := -1084.0, Y:= 2587.999982, Z:= 3160.0}
         else if(RandomInt = 2):
             tapelocation:vector3 = vector3{X := 0.0, Y:= 0.0, Z:= 0.0}
         else if(RandomInt = 3):
             tapelocation:vector3 = vector3{X := 0.0, Y:= 0.0, Z:= 0.0}
     

    
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
    tapeProp.Dispose()
             
    var spawnTapeLocation:vector3 = vector3{Translation:= tapelocation}

    SpawnProp(tapeAsset,transform{Translation:= spawnTapeLocation})
    

     
        

```

---

<div class="post-metadata">

**Author:** ![LilWikipedia](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lilwikipedia/32/1139663_2.png) [@LilWikipedia](https://forums.unrealengine.com/u/LilWikipedia)\
**Post date:** [February 18, 2025, 10:43pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/2 "2025-02-18T22:43:16Z")

</div>

Can you be more specific about the error your getting? or what is not working? Right off the bat i can see that your `OnBegin` is outside of the device’s scope…

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [February 19, 2025, 5:53am UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/3 "2025-02-19T05:53:23Z")

</div>

TapeLocationDecider Should be turned to this

```auto
    TapeLocationDecider()<transacts>:vector3=    
        var RandomInt:int = GetRandomInt(1,3)
            if (RandomInt = 1):
                tapelocation:vector3 = vector3{X := -1084.0, Y:= 2587.999982, Z:= 3160.0}
            else if(RandomInt = 2):
                tapelocation:vector3 = vector3{X := 0.0, Y:= 0.0, Z:= 0.0}
            else:
                tapelocation:vector3 = vector3{X := 0.0, Y:= 0.0, Z:= 0.0}

```

And `var spawnTapeLocation:vector3 = vector3{Translation:= tapelocation}` should become `var spawnTapeLocation:vector3 = TapeLocationDecider()`

Also as Lil Wikipedia Mentioned you need to tab the OnBegin a bit to the right so its in device scope

---

<div class="post-metadata">

**Author:** ![alexisabanana](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexisabanana](https://forums.unrealengine.com/u/alexisabanana)\
**Post date:** [February 19, 2025, 4:08pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/4 "2025-02-19T16:08:49Z")

</div>

Thanks, i’m still getting used to Verse. Most errors went away once I had the formatting correctly.

---

<div class="post-metadata">

**Author:** ![alexisabanana](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexisabanana](https://forums.unrealengine.com/u/alexisabanana)\
**Post date:** [February 19, 2025, 4:09pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/5 "2025-02-19T16:09:50Z")

</div>

Thanks for your help. combined with Lil Wikipedia’s formatting. The code does work.

Once again thanks for your helps really appreciate it 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 21, 2025, 4:10pm UTC](https://forums.unrealengine.com/t/prop-spawner/2342833/6 "2025-03-21T16:10:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
