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

How would I make the dialogue GUI show locally for a single player and not the whole server?

Asked by 3 years ago

Do you know how Roblox story games have the dialogue box? Well, that shows for the whole server. My game is similar but it's an RPG, so players will usually be progressing on their own time. Therefore, I need the dialogue to show locally: only for a single player. How would I accomplish this?

0
Use LocalScripts to make the GUI appear for the player. RazzyPlayz 497 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

there are multiple ways to accomplish the thing you want, but i am going to go with the easy way:

if you already have a placeholder dialogue gui in the player's playergui, you can fire a remote to only that client with the specific strings and other data you may need.

--[[the "replication" method, may be slow because you are doing .touched on the server but more reliable since exploiters are unable to fire touch interests on the client]]--
-- local
local remote = workspace.remote -- some location
remote.OnClientEvent:Connect(function(strings,...)
    -- "strings" can either be a table of strings or a single string
    local args = {...}
    -- do gui stuff here 
end)

-- server
local remote = workspace.remote
local someplatform = workspace.Part
someplatform.Touched:Connect(function(p)
    local plr = game:GetService("Players"):GetPlayerFromCharacter(p.Parent)
    remote:FireClient(plr,{"hi","what"},somethingidk)
end)

--[[the "client only" way, less reliable unless you know how to secure a .touched event]]--
local someplatform = workspace.Part
local plr = game:GetService("Players").LocalPlayer
someplatform.Touched:Connect(function(p)
    -- do gui stuff here
end)

keep in mind exploiters can use a basic function to fire all touch interests so i would use something like region3 but .touched still works well

Ad

Answer this question