Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Semi new to Lua, Anybody explain how you have a "printed" text go into a gui? (Purchase log)

This won't save, I can make it so the players name prints, but I don't know how to make that printed name go into the text on the gui (A in game purchase logging gui)

Note: Other people have to see it! not developer console (Unless you can make it work)!

I have no idea where to start, this is all I have so far.. And there are no tutorials online

script.Parent.Touched:connect(function(part)
	    if part.Parent:FindFirstChild("Humanoid") then
        print("Purchased (Pistol 375$) "..part.Parent.Name)
	    end
end)
wait (1)

^ ^ That prints it into the developer console, but Only I can see it, I want people with the GUI to be able to see it, considering you can't give perms for that.

5 comments

0

Can I see the code yo have so far?

0

plox give cooooooooooooooooooooooooooooooooooooooooooooooooooooooofde

0

Yes

1

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

0

Yeah ik the permission part

1 answer

✓ 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.

4 comments

0

Ill give it a try, if it works ill accept the answer, thanks!

0

Why does this make my characters clothing break?

0

Hmm, not sure.. it shouldn't be touching clothing

0

Did you put the annoucement script in a localscript of its own?

This discussion is preserved as it was. New answers, comments, and votes are closed.