Hello, I wanted the sparkles to have a different color at the holy rarity, but I get different colors than I wanted
local BoxClone = RS.Other.Box:Clone()
local Spark = Instance.new("Sparkles")
Spark.Parent = BoxClone
if Chance <= 727 then
Spark.Color = Color3.fromRGB(171, 132, 13) --orange common (get red)
elseif Chance > 727 and Chance <= 929 then
Spark.Color = Color3.fromRGB(131, 131, 131) --grey rare
elseif Chance > 929 and Chance <= 981 then
Spark.Color = Color3.fromRGB(241, 241, 0) --yellow epic
elseif Chance > 981 and Chance <= 996 then
Spark.Color = Color3.fromRGB(0, 239, 239) --legendary blue
elseif Chance > 996 and Chance <= 1000 then
Spark.Color = Color3.fromRGB(0, 0, 0) -- black ???
end
you need make a task.wait()
in every elseif and if
local BoxClone = RS.Other.Box:Clone()
local Spark = Instance.new("Sparkles")
Spark.Parent = BoxClone
if Chance <= 727 then
task.wait(0.1)
Spark.Color = Color3.fromRGB(171, 132, 13) --orange common (get red)
elseif Chance > 727 and Chance <= 929 then
task.wait(0.1)
Spark.Color = Color3.fromRGB(131, 131, 131) --grey rare
elseif Chance > 929 and Chance <= 981 then
task.wait(0.1)
Spark.Color = Color3.fromRGB(241, 241, 0) --yellow epic
elseif Chance > 981 and Chance <= 996 then
task.wait(0.1)
Spark.Color = Color3.fromRGB(0, 239, 239) --legendary blue
elseif Chance > 996 and Chance <= 1000 then
task.wait(0.1)
Spark.Color = Color3.fromRGB(0, 0, 0) -- black ???
end
Nothing changed (I tried with a longer time delay, but it didn’t change anything)
That wont do anything. I think you should put a print(Chance) to check what it is and fix the chance code
gertkeno
(Gert)
February 8, 2023, 5:46pm
#8
can you show more of the script? I do not understand how the values in the log would lead to an orange color
local EClick = game:GetService("ReplicatedStorage").Click
EClick.OnServerEvent:Connect(function(player)
script.Enabled = false
local Purchase = player.Purchase
local CDBox = player.OtherI.CDBox
local RS = game:WaitForChild("ReplicatedStorage")
local Chance = math.random(1,1000)
if Purchase:FindFirstChild("Box") ~= nil and CDBox.Value <= 0 then
local BoxClone = RS.Other.Box:Clone()
local EndPos = workspace.EndPosToBox
BoxClone.Parent = workspace.FromRSClon
local Spark = Instance.new("Sparkles")
Spark.Parent = BoxClone
if Chance <= 727 then
Spark.Color = Color3.fromRGB(171, 132, 13)
elseif Chance > 727 and Chance <= 929 then
Spark.Color = Color3.fromRGB(131, 131, 131)
elseif Chance > 929 and Chance <= 981 then
Spark.Color = Color3.fromRGB(241, 241, 0)
elseif Chance > 981 and Chance <= 996 then
Spark.Color = Color3.fromRGB(0, 239, 239)
elseif Chance > 996 and Chance <= 1000 then
Spark.Color = Color3.fromRGB(0, 0, 0)
end
for i = 0, 1, 0.05 do
wait()
BoxClone.CFrame = BoxClone.CFrame:Lerp(EndPos.CFrame,i)
end
wait(4.9)
BoxClone:Destroy()
CDBox.Value = 3
end
script.Enabled = true
end)
I get this, but not 171, 132, 13
mroaan
(NightCode)
February 8, 2023, 5:53pm
#10
Kingmaster_GamePlay:
Spark.Color
your using Color
instead of SparkleColor
, the Color value is supposed to be read-only, assigning a value to it will generate a completely different color.
2 Likes
You are using the wrong property you have to use sparklecolor
system
(system)
Closed
February 22, 2023, 5:56pm
#12
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.