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

How to create a upgrade that adds sparkles to bricks?

Asked by 10 years ago
script.Parent.Upgrade.Touched:connect(function(hit)
      if hit:FindFirstChild("Cash") then
    hit.Cash.Value = hit.Cash.Value * 99
  hit.Reflectance = hit.Reflectance + 0.7

 end
end)

This is the upgrader script.I want it to add sparkles to bricks it touches. Help please.

1 answer

Log in to vote
0
Answered by 10 years ago

Okay so there's a thing called

Instance.new()

So.

In the Instance.new's parenthesis there are 2 things you can put in

1: The Name (string) of what you want 2: Where it is located

So to make sparkles in the hit part you would do

Instance.new("Sparkles",hit)

BUT

If you want to customize the sparkles, you give it a local name, and you use that.

Lets say you want yellow sparkles Well, Color3 is kind of confusing at first, what I do (the simplest way) is to get a part, inster sparkles, change the color you want, and get the 3 numbers.

Since Color3 is out of 255, you would do something/255 , Something/255, something/255

SO

The Full script for YELLOW sparkles would be

script.Parent.Upgrade.Touched:connect(function(hit)
      if hit:FindFirstChild("Cash") then
    hit.Cash.Value = hit.Cash.Value * 99
  hit.Reflectance = hit.Reflectance + 0.7
    local Sparkles = Instance.new("Sparkles",hit)
    Sparkles.SparkleColor = Color3.new(255/255, 255/255, 0/255)

 end
end)

Hope this helped!

(this also will work with "Fire" as the Instance, and any other thing! So you can make people catch on fire!)

Ad

Answer this question