Create a Snowball

I want to achieve a snowball that

  • is throwable
  • gets thrown in the direction the player clicks with his mouse
  • disintegrates to snow when touching something
  • has a trail.

My have no clue hiw to cope with the first two points. For point 3 I just wanted to script a Touch Event that breaks the joints when its fired. Point 4 is actually pretty easy i think. I simply added a trail to thr model.

How to script point 1 and 2 and are my approaches at points 3 and 4 correct?

Help appreciated :slight_smile:

:crown: Nova_MrRoyal :crown:

4 Likes

You can use this to determine where the mouse is pointing: Mouse.Target

You can then use a Tool and Tool.Activated to detect when mouse clicked, then you can Tween the part (possibly) and take damage if you wish through the players’s humanoid. Let me know if you need me to elaborate, I rushed this a bit. :slightly_smiling_face:

Pretty simple. If you make a tool and make it so that each time someone clicks, you instance a part (and then change its propteries to mimic a snowball)- and then give it a direction.

local direction = (mouse.Hit.p - handle.Attachment.WorldPosition).Unit
snowBall.CFrame = CFrame.new(handle.Attachment.WorldPosition, handle.Attachment.WorldPosition + direction)

Then destroy this snowBall upon it touching something, and simulataneously play a particleEmitter that looks likes it got ‘splashed’.

Lastly, as for the trail, in the handle (the actual snowball). Put additionally two more attachments (0 and 1). Which your trail can refer to. And so when the snowball has been thrown, you enable the trail.

I recommend that you check out fastCast, where they make everything EASIER for you. It is an awesome module and I recommend every noobish pleb like myself to use it.

4 Likes

Not worth fretting over but I figure I want to point out that CFrame.p is deprecated. The proper property to use is CFrame.Position. p was deprecated in favour of Position for the sake of readability (a variable that isn’t just a single letter) and to stay in line with current PascalCase method/property naming conventions.

I see! Thank you. I did see something similar mentioned before. I do however have an inquiry about something getting deprecated. What does this entail, is roblox discontinuing updating it and may one day remove it? Or is this just a preference for people of DevForum?

It is roblox discontinuing updates for it and one day (maybe) removing it. You should never use deprecated things as it may be removed.

Thank you a lot for the clarification! A bit paranoid right now, because I haven’t really paid any heed to features getting deprecated. Is there a list of said deprecated things that I can glance at :eyes:

If you search it up there should be a roblox page with the tag Deprecated on it or not depending on if it has been Deprecated or not.

Deprecation refers to an API member or feature where support drops and there is intention for removal. Legacy is the same but with no removal intention. Same as what MineDevs said.

There isn’t necessarily a list available. Deprecated items have a deprecated tag internally which can be viewed through an API Reference page (e.g. Anaminus’s API Reference) or via Release Notes. Deprecated members simply don’t show up on the Developer Hub. If you check the CFrame datatype, p will not show; Position will.

I’m free to answer other questions or whatnot privately to prevent hijacking this thread with talk about the API.

2 Likes

The snowBall variable in your script is probably the new instance, but whats the handle then? And what’s the attachment?

Imagine that you have tool, right? You need handle for holding it. And the attachment resides in that handle.

Heres an image of the tool:

grafik

Heres ab image of the script:

It doesn’t work. Did I made a mistake?

That is just to give you the direction of which way the snowball should go, you’ll have to apply a force(ex: vectorForce) to the part.

I STRONGLY URGE YOU TO CHECK FASTCAST OUT!

As previously mentioned, they have a much more elaborate explanation.

1 Like

How would I do that? I am not experienced in this field. Sorry if i’m annoying

Edit: Ima check FastCast out. Thank You :v:

You were absolutely right! The FastCast Module really helped me out. I solved my problem :slight_smile:

1 Like