Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago
Edited 5 years ago

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.

0
Can I see the code yo have so far? royaltoe 5144 — 5y
0
plox give cooooooooooooooooooooooooooooooooooooooooooooooooooooooofde BashGuy10 384 — 5y
0
Yes killerbrasko2002 33 — 5y
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 voidofdeathfire 148 — 5y
0
Yeah ik the permission part killerbrasko2002 33 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

0
Ill give it a try, if it works ill accept the answer, thanks! killerbrasko2002 33 — 5y
0
Why does this make my characters clothing break? killerbrasko2002 33 — 5y
0
Hmm, not sure.. it shouldn't be touching clothing JasonTheOwner 391 — 5y
0
Did you put the annoucement script in a localscript of its own? JasonTheOwner 391 — 5y
Ad

Answer this question