that happens when you hit it on the client and the result comes from the remote event firing all the client to the server but sure here is the script of the plates turning neon
local Buttons = {script.Button1.Value,script.Button2.Value,script.Button3.Value}
game.ReplicatedStorage.VoteWin.OnClientEvent:Connect(function(Button)
game:GetService("TweenService"):Create(Button,TweenInfo.new(0.25,Enum.EasingStyle.Linear),{Color = Color3.fromRGB(133, 200, 133)}):Play()
for i,v in pairs(Buttons) do
if v.Clicky ~= Button then
game:GetService("TweenService"):Create(v.Clicky,TweenInfo.new(0.25,Enum.EasingStyle.Linear),{Color = Color3.fromRGB(125, 125, 125)}):Play()
end
end
task.wait(4)
game:GetService("TweenService"):Create(Button,TweenInfo.new(0.25,Enum.EasingStyle.Linear),{Color = Color3.fromRGB(125, 125, 125)}):Play()
end)
function GetPlayerByHit(Hit:Instance,Debug:boolean)
if Hit:FindFirstAncestorOfClass("Model") and game.Players:GetPlayerFromCharacter(Hit:FindFirstAncestorOfClass("Model")) ~= nil then
if Debug == true then
warn("Hit is from a character/player | ".. Hit:GetFullName())
end
local Character = Hit:FindFirstAncestorOfClass("Model")
local Humanoid
local Player = game.Players:GetPlayerFromCharacter(Character)
local HumanoidRoot
if Character:FindFirstChildOfClass("Humanoid") ~= nil then
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end
if Character:FindFirstChild("HumanoidRootPart") ~= nil then
HumanoidRoot = Character:FindFirstChild("HumanoidRootPart")
end
return {Character = Character, Humanoid = Humanoid,Player = Player,HumanoidRoot = HumanoidRoot}
else
if Debug == true then
warn("Hit is not a character/player")
end
return {Character = nil, Humanoid = nil,Player = nil,HumanoidRoot = nil}
end
end
for i,v in pairs(Buttons) do
v.Clicky.Touched:Connect(function(Hit)
if workspace.GameData.Voting.Value > 0 then
local Info = GetPlayerByHit(Hit,true)
if Info.Player == game.Players.LocalPlayer then
game:GetService("TweenService"):Create(v.Clicky,TweenInfo.new(0.25,Enum.EasingStyle.Linear),{Color = Color3.fromRGB(100, 150, 100)}):Play()
for i2,v2 in pairs(Buttons) do
if v2.Clicky ~= v.Clicky then
game:GetService("TweenService"):Create(v2.Clicky,TweenInfo.new(0.25,Enum.EasingStyle.Linear),{Color = Color3.fromRGB(125, 125, 125)}):Play()
end
end
end
end
end)
end
just saying the main problem is at the script i gave all the votes are gathered correctly but i cant seem to get the result correctly since it can tie with the highest and the lowest which could make it vote something random