I have a button for a "Yellow Trail" and a button for a "Grey Trail", the first time I click one of the buttons, it works, but then every time I click it after that, it just turns black. Oh and the yellow button is the only one that works, when I click the grey button, the streak / trail still turns yellow, even though I am not telling it to.
Info:
- I have 1 remote event called Streak, inside a folder called LockerItems, in replicatedstorage
- I have one trail called Streak, inside a folder called ShopItems, inside of ServerStorage
Yellow Button Local Script
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
local colour = "255,255,0"
game.ReplicatedStorage.LockerItems["Streak"]:FireServer(colour)
end
end)
game.Players.LocalPlayer.leaderstats1["Yellow Streak"].Changed:Connect(function()
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
end
end)
game.Players.PlayerAdded:Connect(function()
wait(2.5)
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
end
end)
Grey Button Local Script
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
local colour = "61,61,61"
game.ReplicatedStorage.LockerItems["Streak"]:FireServer(colour)
end
end)
game.Players.LocalPlayer.leaderstats1["Grey Streak"].Changed:Connect(function()
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
end
end)
game.Players.PlayerAdded:Connect(function()
wait(2.5)
if game.Players.LocalPlayer.leaderstats1:FindFirstChild(script.Parent.Text).Value == true then
script.Parent.Active = true
script.Parent.BackgroundTransparency = 0.5
script.Parent.Parent.BackgroundTransparency = 0
script.Parent.Parent.ImageTransparency = 0
script.Parent.TextTransparency = 0
end
end)
Server Script Handler
game.ReplicatedStorage.LockerItems["Streak"].OnServerEvent:Connect(function(player, colour)
if player.Character.HumanoidRootPart:FindFirstChild("Streak") then
player.Character.HumanoidRootPart:FindFirstChild("Streak").Color = ColorSequence.new(Color3.new(colour))
if colour == "61,61,61" then
player.Character.HumanoidRootPart:FindFirstChild("Streak").Transparency = 0.5
else
player.Character.HumanoidRootPart:FindFirstChild("Streak").Transparency = NumberSequence.new(0.1)
end
else
local char = player.Character
local trail = game.ServerStorage.ShopItems["Streak"]:Clone()
trail.Parent = char.HumanoidRootPart
trail.Attachment0 = char.Head.FaceFrontAttachment
trail.Attachment1 = char.HumanoidRootPart.RootRigAttachment
end
end)
Thanks!
