✓ Accepted answer
Put this in your server script when the item is touched and purchased. You may want to fire a separate
event of course for the actual purchase - I'd do a server function for that.
local AnnoucementEvent = Instance.new("RemoteEvent",game.ReplicatedStorage)
AnnoucementEvent.Name="GameToClientGuiEvent"
local istouched=false
script.Parent.Touched:connect(function(part)
if istouched==false then
istouched=true
if part.Parent:FindFirstChild("Humanoid") then
print("firing the annoucement event")
local player = game.Players:GetPlayerFromCharacter(part.Parent)
local message = player.Name.." bought the item!!!!"
AnnoucementEvent:FireAllClients(message)
end
wait(3)
local message = ""
AnnoucementEvent:FireAllClients(message)
istouched=false
end
end)
Then in a localscript under StarterPlayerScripts (I named mine PlayerAnnoucements)
local AnnoucementEvent = game.ReplicatedStorage:WaitForChild("GameToClientGuiEvent",10)
local Player = game.Players.LocalPlayer
local GUI = Player.PlayerGui
local AnnoucementScreenGui = Instance.new("ScreenGui")
AnnoucementScreenGui.Name = "AnnoucementScreenGui"
AnnoucementScreenGui.Parent = GUI
local AnnounementFrame = Instance.new("Frame")
AnnounementFrame.Name = "AnnounementFrame"
AnnounementFrame.Position = UDim2.new(1,-500,0,0)
AnnounementFrame.Size = UDim2.new(0,500,0,50)
AnnounementFrame.BackgroundTransparency = .5
AnnounementFrame.Parent = AnnoucementScreenGui
local AnnoucementText = Instance.new("TextLabel",AnnounementFrame)
AnnoucementText.Size = UDim2.new(1,0,1,0)
AnnoucementText.TextSize = 32
AnnoucementText.TextScaled = true
AnnoucementText.BackgroundTransparency = .5
AnnoucementText.Text = ""
function UpdateAnnouncementScreenGui(str)
AnnoucementText.Text = str
end
AnnoucementEvent.OnClientEvent:connect(UpdateAnnouncementScreenGui)
There's plenty of room for improvement.. you may want to append the message....
I would have the AnnoucementFrame and Text elements already preset under StarterGui and so all the script has to do is set the Text value.. but I'll leave the rest to you to figure out... Let me know if you need more help.
5 comments
Can I see the code yo have so far?
plox give cooooooooooooooooooooooooooooooooooooooooooooooooooooooofde
Yes
Um you need to know remote events and make a gui. Printing gui in the dev console only allows people to see it if A) they caused the print or B) they are owner or have owner perms. If you want to show that then you would need to get a remote event and make a gui. Plus that make it so that they can only see it with permission scripting
Yeah ik the permission part