I think I found the problem; the color
18:05:00.547 Unable to assign property Color. ColorSequence expected, got Color3 - Client - LocalScript:13
18:05:00.547 Stack Begin - Studio
18:05:00.548 Script ‘Players.ptitloup132.Backpack.Baguette en bois.LocalScript’, Line 13 - function createParticleEmitter - Studio - LocalScript:13
18:05:00.548 Script ‘Players.ptitloup132.Backpack.Baguette en bois.LocalScript’, Line 43 - function createPart - Studio - LocalScript:43
18:05:00.548 Script ‘Players.ptitloup132.Backpack.Baguette en bois.LocalScript’, Line 58 - function createBeam - Studio - LocalScript:58
18:05:00.548 Script ‘Players.ptitloup132.Backpack.Baguette en bois.LocalScript’, Line 73 - Studio - LocalScript:73
18:05:00.548 Stack End - Studio
I changed the code because it’s was black… and I got this error
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local debounce = true -- cooldown check
local cooldown = 0.5 -- cooldown
local function createParticleEmitter(color, parent)
local particleEmitter = Instance.new("ParticleEmitter")
particleEmitter.Color = ColorSequence.new(color)
particleEmitter.LightEmission = 1
particleEmitter.LightInfluence = 1
particleEmitter.Orientation = "FacingCamera"
particleEmitter.Size = NumberSequence.new(0.2)
particleEmitter.Squash = NumberSequence.new(0)
particleEmitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
particleEmitter.Transparency = NumberSequence.new(0.5)
particleEmitter.Rate = 100
particleEmitter.EmissionDirection = "Top"
particleEmitter.Lifetime = NumberRange.new(0.3,0.3)
particleEmitter.RotSpeed = NumberRange.new(0.2)
particleEmitter.Speed = NumberRange.new(1)
particleEmitter.SpreadAngle = Vector2.new(1, 1)
particleEmitter.Shape = "Cylinder"
particleEmitter.ShapeInOut = "Outward"
particleEmitter.ShapePartial = 1
particleEmitter.ShapeStyle = "Surface"
particleEmitter.TimeScale = 1
particleEmitter.Parent = parent
end
local function createPart(color, beam)
local part = Instance.new("Part")
part.Parent = workspace
part.Name = "PartEffetBeamSort"
part.Anchored = true
part.CFrame = beam.Attachment0.WorldCFrame:Lerp(beam.Attachment1.WorldCFrame, 0.5)
part.Size = Vector3.new(0.5, 0.5, (beam.Attachment0.WorldCFrame.Position - beam.Attachment1.WorldCFrame.Position).Magnitude)
part.Transparency = 1
createParticleEmitter(color, part)
end
local function createBeam(color, attachment1)
local beam = Instance.new("Beam")
beam.Color = ColorSequence.new(color)
local attachment0 = Instance.new("Attachment", handle.EndBaguette)
beam.Attachment0 = attachment0
beam.Attachment1 = attachment1
beam.FaceCamera = true
beam.LightEmission = 0.5
beam.Transparency = NumberSequence.new(0.5)
beam.Width0 = 0.2
beam.Width1 = 0.2
beam.Parent = workspace
createPart(color, beam)
return beam
end
tool.Equipped:Connect(function()
mouse.Button1Down:Connect(function()
local ray = Ray.new(plr.Character.HumanoidRootPart.Position, (mouse.Hit.p - plr.Character.HumanoidRootPart.Position).unit * 300)
local part, position = game.Workspace:FindPartOnRay(ray, plr.Character)
if part and part.Parent then
local character = part.Parent
local targetHRP = character:FindFirstChild("HumanoidRootPart")
if targetHRP and debounce then
local color = Color3.fromRGB(125, 125, 125)
local attachment1 = Instance.new("Attachment", targetHRP)
local beam = createBeam(color, attachment1)
wait(1)
game:GetService("ReplicatedStorage").Events.DamagePlayer:FireServer(targetHRP.Parent:FindFirstChild("Humanoid"), 10)
beam:Destroy()
--workspace:FindFirstChild("PartEffetBeamSort"):Destroy()
attachment1:Destroy()
handle.EndBaguette:FindFirstChild("Attachment"):Destroy()
debounce = false
wait(cooldown)
debounce = true
end
end
end)
mouse.Button2Up:Connect(function()
plr.PlayerGui.SortsSelection.Enabled = false
end)
mouse.Button2Down:Connect(function()
plr.PlayerGui.SortsSelection.Enabled = true
end)
end)
Fixed but the part is not like the beam :(, I mean the part with the same angle for example.
make the part completely opaque and show a video, what do you mean same angle?
And by the way, the beam is following the attachment, not the part, but it’s not really a problem, the duration effect is 0.1s
try using
Part.CFrame = CFrame.lookAt(Part.Position, Attachment1.WorldCFrame.Position)
If not then it might get a bit complicated
Still with a visual not valid, it’s on the left of the beam :(.
This is some rough code, hopefully it works
local direction = (beam.Attachment0.WorldCFrame.Position - beam.Attachment1.WorldCFrame.Position).Unit
Part.CFrame = CFrame.lookAt(Part.Position, Part.Position + direction)
1 Like
Sadly no :(, not too long, good angle but not on the beam.
Can you send a video?
chars bruh
Just in case you just completely replaced the code, those lines were only for rotating the part, you still need to keep this line
part.CFrame = beam.Attachment0.WorldCFrame:Lerp(beam.Attachment1.WorldCFrame, 0.5)
1 Like
Ah my bad, I’ll do it soon, thx :).
Thanks !!! It works Have a great day/night!
1 Like
instead of creating the beam and the particle emitter using a script, u can just create them normally and then clone them, but u do what u do
system
(system)
Closed
July 31, 2024, 11:56am
#37
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.