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

Why are my colours not being coloured via script / color wheel? [closed]

Asked by 3 years ago
Edited 3 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.



--ColourPickerScript local colourGradientFrame = script.Parent.ColourGradientFrame local colourSlider = colourGradientFrame:WaitForChild("Slider") local darknessGradientFrame = script.Parent.DarknessGradientFrame local darknessSlider = darknessGradientFrame:WaitForChild("Slider") local colourPreview = script.Parent.ColourPreview local whichSelected = nil local selectedFire = false local mouse = game.Players.LocalPlayer:GetMouse() local movingColourSlider = false local movingDarknessSlider = false script.Parent.Parent:WaitForChild("ToolGui").Firetool.MouseButton1Click:Connect(function(value) script.Parent.Enabled = not script.Parent.Enabled end) colourSlider.MouseButton1Down:Connect(function() movingColourSlider = true end) colourGradientFrame.MouseButton1Down:Connect(function() movingColourSlider = true end) darknessSlider.MouseButton1Down:Connect(function() movingDarknessSlider = true end) darknessGradientFrame.MouseButton1Down:Connect(function() movingDarknessSlider = true end) colourSlider.MouseButton1Up:Connect(function() movingColourSlider = false end) colourGradientFrame.MouseButton1Up:Connect(function() movingColourSlider = false end) darknessSlider.MouseButton1Up:Connect(function() movingDarknessSlider = false end) darknessGradientFrame.MouseButton1Up:Connect(function() movingDarknessSlider = false end) mouse.Button1Up:Connect(function() movingColourSlider = false movingDarknessSlider = false end) mouse.Move:Connect(function() if movingColourSlider then local xOffset = (mouse.X - colourGradientFrame.AbsolutePosition.X) xOffset = math.clamp(xOffset, 0, colourGradientFrame.AbsoluteSize.X) local sliderPosNew = UDim2.new(0, xOffset, colourSlider.Position.Y) colourSlider.Position = sliderPosNew end if movingDarknessSlider then local xOffset = (mouse.X - colourGradientFrame.AbsolutePosition.X) xOffset = math.clamp(xOffset, 0, colourGradientFrame.AbsoluteSize.X) local sliderPosNew = UDim2.new(0, xOffset, colourSlider.Position.Y) darknessSlider.Position = sliderPosNew end end) function returnColour(percentage, gradientKeyPoints) local leftColour = gradientKeyPoints[1] local rightColour = gradientKeyPoints[#gradientKeyPoints] local lerpPercent = 0.5 local colour = leftColour.Value for i = 1, #gradientKeyPoints - 1 do if gradientKeyPoints[i].Time <= percentage and gradientKeyPoints[i + 1].Time >= percentage then leftColour = gradientKeyPoints[i] rightColour = gradientKeyPoints[i + 1] lerpPercent = (percentage - leftColour.Time) / (rightColour.Time - leftColour.Time) colour = leftColour.Value:Lerp(rightColour.Value, lerpPercent) return colour end end end function updateColourPreview() local selected = whichSelected local colourMinXPos = colourGradientFrame.AbsolutePosition.X local colourMaxXPos = colourMinXPos + colourGradientFrame.AbsoluteSize.X local colourXPixelSize = colourMaxXPos - colourMinXPos local colourSliderX = colourSlider.AbsolutePosition.X local colourXPos = (colourSliderX - colourMinXPos) / colourXPixelSize local darknessMinXPos = darknessGradientFrame.AbsolutePosition.X local darknessMaxXPos = darknessMinXPos + darknessGradientFrame.AbsoluteSize.X local darknessXPixelSize = darknessMaxXPos - darknessMinXPos local darknessSliderX = darknessSlider.AbsolutePosition.X local darknessXPos = (darknessSliderX - darknessMinXPos) / darknessXPixelSize local darkness = returnColour(darknessXPos, darknessGradientFrame.DarknessGradient.Color.Keypoints) local darknessR, darknessG, darknessB = 255 - math.floor(darkness.R * 255), 255 - math.floor(darkness.G * 255), 255 - math.floor(darkness.B * 255) local colour = returnColour(colourXPos, colourGradientFrame.ColourGradient.Color.Keypoints) local colourR, colourG, colourB = math.floor(colour.R * 255), math.floor(colour.G * 255), math.floor(colour.B * 255) local resultColour = Color3.fromRGB(colourR - darknessR, colourG - darknessG, colourB - darknessB) local totalColor = Color3.fromRGB(colourR, colourG, colourB) local totalDarkness = Color3.fromRGB(darknessR, darknessG, darknessB) colourPreview.BackgroundColor3 = resultColour script.Parent:WaitForChild("ConfirmButton").MouseButton1Click:Connect(function(value) game.Players.LocalPlayer.Choices.RGB.Value = resultColour end) end colourSlider:GetPropertyChangedSignal("Position"):Connect(updateColourPreview) darknessSlider:GetPropertyChangedSignal("Position"):Connect(updateColourPreview)` --Script that actually colours it local Cooldown = false local CDTime = 45 local Damage = 40 script.Parent.OnServerEvent:Connect(function(Player) if Cooldown then return end spawn(function() Cooldown = true wait(CDTime) Cooldown = false end) local white = Color3.fromRGB(255,255,255) local Character = Player.Character local Value = Color3.fromRGB(Player:WaitForChild("Choices").RGB.Value) local Susanoo = game.ReplicatedStorage["Sasuke Perfect Susanoo"]:Clone() Susanoo.Susanoo.Color = Player:WaitForChild("Choices").RGB.Value Susanoo.Susanoo.PointLight.Color = Player:WaitForChild("Choices").RGB.Value Susanoo.Susanoo.fireball.Color = ColorSequence.new(Value, white) Susanoo.Parent = Character Susanoo:MoveTo(Player.Character.HumanoidRootPart.Position + Vector3.new(0,11,0)) local Weld = Instance.new("Weld",Susanoo.HumanoidRootPart) Weld.Part0 = Susanoo.Susanoo Weld.Part1 = Player.Character.HumanoidRootPart wait(25) Susanoo:Destroy() end)
0
How it works is it's a value you put in a folder. Players > ScarletHypernova (me) > Choices (folder) > RGB (color3value) ScarletHypernova -5 — 3y
0
What type of script is the second one, and where is it located?? User#32819 0 — 3y
0
StarterPack > Susanoo Local Script > RemoteEvent > Script ScarletHypernova -5 — 3y
0
its a normal script sorry im new to this ScarletHypernova -5 — 3y
View all comments (6 more)
0
"Normal scripts" don't run on the StarterPack. Put the remote in ReplicatedStorage, and the "normal script" inside ServerScriptService. You might want to send the "choices" value over the remote as things changed by the client aren't detected by the server. User#32819 0 — 3y
0
what do you mean by "You might want to send the "choices" value over the remote"? ScarletHypernova -5 — 3y
0
RemoteEvents accept tuple as arguments, that is, you can send literally anything in :FireServer(), and receive it in .OnServerEvent. See this article for more information: https://developer.roblox.com/en-us/api-reference/class/RemoteEvent User#32819 0 — 3y
0
whatever I do it "Susanoo" and the particle always turns black. ScarletHypernova -5 — 3y
0
Because the server can't see that the value has been changed, as it has been changed by a local script. User#32819 0 — 3y
0
so how do I fix that? do I have to change the local script to a normal script? ScarletHypernova -5 — 3y

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?