Log in to vote

How to make a script that spawns a model on button click?

Asked by
Xyternal 192
4 months ago
Edited 4 months ago

Hello everyone! I was creating a boat fighting game where people have to press a button, and the boat model will spawn. I have constructed the boat and all, but I still don't know how to make the script (I am really, really new to scripting). Can you please send me links to tutorials? Or better, give me instructions on what to do? Thank you!

I always recommend peaspod for people who wanna get into scripting: prooheckcp 340 — 4mo
Alright thank you! Xyternal 192 — 4mo

1 answer

Log in to vote
Answered by 4 months ago

So I'm a little new to scripting as well but I think this would work. What you can do is add the boat model into lighting then clone it and set the parent to workspace or whatever. Then set the position.

Boat = game.Lighting.BoatModel --wherever your boat model is
button = game.StarterGui.Button -- wherever your button is

    BoatClone = Boat:Clone() -- clones the Boat
    BoatClone.Parent = workspace -- Sets the parent to workspace
    BoatClone.Position =,0,0) -- zero,zero,zero is the middle of the world

This should work, I might have some syntax error though. Sorry I can't check it as I am currently at school and they have blocked Roblox studio ;(

Thank you very much. I will try this solution out Xyternal 192 — 4mo

Answer this question