Incorrect Notifications for Player

Greetings! I have problems with Notifications after the Map Vote. It shows another text for another player, while in Player1 it shows correct text. I don’t know why it happens, hopefully i will found a solution from you.

Here is all codes with Notifications

-- Main Notification ModuleScript

local tweenServ = game:GetService("TweenService")
local players = game:GetService("Players")
local plr = players.LocalPlayer
local plUI = plr:WaitForChild("PlayerGui")
local notifications = plUI:WaitForChild("Notifications")
local cont = notifications:WaitForChild("Frame")

local template = script:WaitForChild("Notification")
local origSize = template.Size

local module = {}

function module.Notify(notificationText, duration)
	local newNotif = template:Clone()
	newNotif.Size = UDim2.fromScale(0, 0)
	
	newNotif.TextLabel.Text = notificationText
	
	newNotif.TextLabel.Transparency = 1
	newNotif.BackgroundTransparency = 1
	newNotif.Parent = cont
	
	tweenServ:Create(newNotif, TweenInfo.new(0.2), {BackgroundTransparency = 0}):Play()
	tweenServ:Create(newNotif.TextLabel, TweenInfo.new(0.3), {TextTransparency = 0}):Play()
	
	tweenServ:Create(newNotif, TweenInfo.new(0.4, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out), {Size = origSize}):Play()
	script.NotifSound:Play()
	
	task.wait(duration)
	
	tweenServ:Create(newNotif, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
	tweenServ:Create(newNotif.TextLabel, TweenInfo.new(0.3), {TextTransparency = 1}):Play()

	tweenServ:Create(newNotif, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.fromScale(0, 0)}):Play()
	
	task.wait(1)
	newNotif:Destroy()
end

return module
-- MAIN VOTE SCRIPT

local toggleVoteEvent = game.ReplicatedStorage.ToggleVoteEvent
local option1 = game.ReplicatedStorage.VoteValues.Option1
local option2 = game.ReplicatedStorage.VoteValues.Option2
local option3 = game.ReplicatedStorage.VoteValues.Option3
local notifEvent = game.ReplicatedStorage.VoteNotifEvent
local roundEndEvent = game.ReplicatedStorage.RoundEndEvent
local teleportScript = game.Workspace.Teleport1.Part1.Script
local spawn1 = game.Workspace.SpawnLocation

local endTeleport = game.ReplicatedStorage.RoundEndTeleportEvent

while true do
	wait(20)
	toggleVoteEvent:FireAllClients(true)

	wait(10)
	toggleVoteEvent:FireAllClients(false)
	
	
	for _, plr in pairs(game.Players:GetPlayers()) do
		if option1.Value > option2.Value and option3.Value then
			print("[Option 1 win] [Vote Output]")
			game.ReplicatedStorage.Notify:FireClient(plr, "Industrial has won the vote!", 5)
		elseif option2.Value > option1.Value and option3.Value then
			print("[Option 2 win] [Vote Output]")
			game.ReplicatedStorage.Notify:FireClient(plr, "Winter has won the vote!", 5)
		elseif option3.Value > option2.Value and option1.Value then
			print("[Option 3 win] [Vote Output]")
			game.ReplicatedStorage.Notify:FireClient(plr, "Forest has won the vote!", 5)
		elseif option1.Value == option2.Value then
			print("[Tied] [Vote Output]")
			option1.Value = math.random(1, 100)
			option2.Value = math.random(1, 100)
			game.ReplicatedStorage.Notify:FireClient(plr, "Tie. Random map.", 5)
		elseif option3.Value == option2.Value then
			print("[Tied] [Vote Output]")
			option2.Value = math.random(1, 100)
			option3.Value = math.random(1, 100)
			game.ReplicatedStorage.Notify:FireClient(plr, "Tie. Random map.", 5)
		elseif option1.Value == option3.Value then
			print("[Tied] [Vote Output]")
			option1.Value = math.random(1, 100)
			option3.Value = math.random(1, 100)
			game.ReplicatedStorage.Notify:FireClient(plr, "Tie. Random map.", 5)
		elseif option1.Value == option2.Value and option1.Value == option3.Value and option2.Value == option3.Value then
			print("[Tied] [Vote Output]")
			option1.Value = math.random(1, 100)
			option2.Value = math.random(1, 100)
			option3.Value = math.random(1, 100)
			game.ReplicatedStorage.Notify:FireClient(plr, "Tie. Random map.", 5)
		end
	end
	teleportScript.Enabled = true
	notifEvent:FireAllClients(true)	

	wait(15)
	
	roundEndEvent:FireAllClients(true)
	
	for _, plr in pairs(game.Players:GetPlayers()) do
		game.ReplicatedStorage.Notify:FireClient(plr, "Round has ended, new vote will start soon!", 5)
	end
	
	teleportScript.Enabled = false
	print("[New Vote] [Vote Output]")
	option1.Value = 0
	option2.Value = 0
	option3.Value = 0
	
	endTeleport:FireAllClients(true)
	
	endTeleport.OnServerEvent:Connect(function(plr)
		plr.Character:PivotTo(CFrame.new(153.7, 11.5, -163.5))
	end)
	
end
-- Local Notification Script
local rs = game:GetService("ReplicatedStorage")
local notifClient = require(rs:WaitForChild("Notifications"))

rs:WaitForChild("Notify").OnClientEvent:Connect(function(notificationText, duration)
	notifClient.Notify(notificationText, duration)
end)

Right one is correct variant

1 Like

ok nice can i say how did you got the hammer in your profile?

You need to complete an advance user tutorial with Discobot, then you can join to the groups on Developer Forum | Roblox
Then in your Account Preferences you need to set a Title and Flair

Nvm, i have fixed this problem. #30lettersbypass

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.