so i have script that makes a custom bullet, but when i try it out two things happened:
the bullet was black when its supposed to be yellow and the trail isn’t showing up
heres the part where it makes the bullet:
local bulletTemplate = Instance.new("Part")
bulletTemplate.Shape = Enum.PartType.Ball
bulletTemplate.Size = Vector3.new(0.5, 0.5, 0.5)
bulletTemplate.Material = Enum.Material.Neon
bulletTemplate.Color = Color3.new(255, 255, 0)
local att1 = Instance.new("Attachment")
att1.Name = "Att1"
att1.Position = Vector3.new(0.2, 0, 0.1)
att1.Parent = bulletTemplate
local att0 = Instance.new("Attachment")
att0.Name = "Att0"
att0.Position = Vector3.new(0.1, 0, -0.2)
att0.Parent = bulletTemplate
local trail = Instance.new("Trail")
trail.Color = ColorSequence.new(Color3.new(255,255,0), Color3.new(255,255,0))
trail.Lifetime = 1
trail.MaxLength = 5
trail.MinLength = 0.1
local keypoints = {}
table.insert(keypoints, NumberSequenceKeypoint.new(0, 1))
table.insert(keypoints, NumberSequenceKeypoint.new(0.195, 0.00625))
table.insert(keypoints, NumberSequenceKeypoint.new(1, 0))
local multiValueSequence = NumberSequence.new(keypoints)
trail.WidthScale = multiValueSequence
1 Like
sussy_bacoo:
trail.Color = ColorSequence.new(Color3.new(255,255,0), Color3.new(255,255,0))
The cause of one of your issues is this line
Color3 itself only takes a value between 0 and 1, not 0 and 255
Try this slightly modified line:
trail.Color = ColorSequence.new(Color3.fromRGB(255,255,0), Color3.fromRGB(255,255,0))
fromRGB changes it to 0 - 255
Same thing at the top with the bullet
Color3.new(255, 255, 0)
should be
Color3.fromRGB(255, 255, 0)
Corrected Script
local bulletTemplate = Instance.new("Part")
bulletTemplate.Shape = Enum.PartType.Ball
bulletTemplate.Size = Vector3.new(0.5, 0.5, 0.5)
bulletTemplate.Material = Enum.Material.Neon
bulletTemplate.Color = Color3.fromRGB(255, 255, 0)
local att1 = Instance.new("Attachment")
att1.Name = "Att1"
att1.Position = Vector3.new(0.2, 0, 0.1)
att1.Parent = bulletTemplate
local att0 = Instance.new("Attachment")
att0.Name = "Att0"
att0.Position = Vector3.new(0.1, 0, -0.2)
att0.Parent = bulletTemplate
local trail = Instance.new("Trail")
trail.Color = ColorSequence.new(Color3.fromRGB(255,255,0), Color3.fromRGB(255,255,0))
trail.Lifetime = 1
trail.MaxLength = 5
trail.MinLength = 0.1
local keypoints = {}
table.insert(keypoints, NumberSequenceKeypoint.new(0, 1))
table.insert(keypoints, NumberSequenceKeypoint.new(0.195, 0.00625))
table.insert(keypoints, NumberSequenceKeypoint.new(1, 0))
local multiValueSequence = NumberSequence.new(keypoints)
trail.WidthScale = multiValueSequence
it didn’t change anything sadly
Here is the full code
Hopefully it works for you
local bulletTemplate = Instance.new("Part")
bulletTemplate.Color = Color3.fromHex("#FFFF00")
bulletTemplate.Shape = Enum.PartType.Ball
bulletTemplate.Size = Vector3.new(0.5,0.5,0.5)
bulletTemplate.Material = Enum.Material.Neon
local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.Parent = bulletTemplate
attachment1.Position = Vector3.new(0.2 ,0,0.1)
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment0.Parent = bulletTemplate
attachment0.Position = Vector3.new(0.1,0,-0.2)
local trail = Instance.new("Trail")
trail.Parent = bulletTemplate
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
trail.Color = ColorSequence.new(Color3.fromHex("#FFFF00"), Color3.fromHex("#FFFF00"))
trail.Lifetime = 1
trail.MaxLength = 5
trail.MinLength = 0.1
local keypoints = {}
table.insert(keypoints, NumberSequenceKeypoint.new(0, 1))
table.insert(keypoints, NumberSequenceKeypoint.new(0.195, 0.00625))
table.insert(keypoints, NumberSequenceKeypoint.new(1, 0))
local multiValueSequence = NumberSequence.new(keypoints)
trail.WidthScale = multiValueSequence
The api-reference is a great tool on debugging any errors you encounter
https://developer.roblox.com/en-us/api-reference
What is the script you currently have then (including any changes)
it works but the trail goes down, then goes like the bullet
If you could send a video of what happens that would be great!