there are values you can manipulate within the player called CameraMaxZoomDistance and CameraMinZoomDistance, along with changing camera mode you should be able to move your mouse around freely
You can unlock the mouse like this:
- Create a UI.
- Add a TextButton.
- Set the TextButton Size to
UDim2.new(0,0,0,0)
- When you want to unlock the mouse, change the TextButton’s Modal to TRUE
If you want to lock again the mouse, set the TextButton’s Modal to FALSE
I use this to unlock mouse in my games.
I know about those values, that is how I made the game first person, but how am I supposed to enable it? Every tutorial I found, had it so when the respond to the initial prompt, not when you click the big bubble that starts the conversation, the gui and other stuff appear. I can’t respond to the initial prompt, if I am in first person, but I can’t change that if I can’t do anything when I click the bubble.
Add a local script inside starterplayerscripts:
local event = game.ReplicatedStorage.DialogEvent
event.OnClientEvent:Connect(function(plr,dialog)
-- Do something...
end)
When you fire a Remote to the client, you can do this
:FireClient(player,true)
or with false
and in a LocalScript inside the gui, when
.OnClientEvent:Connect(function(value)
Do this:
script.Parent.TextLabel.Modal = value
So i’ll look like this.
game.ReplicatedStorage.DialogEvent.OnClientEvent:Connect(function(value)
script.Parent.TextLabel.Modal = value
end)
I basically already have that, but I can’t start the event because I can’t find a way to for example, print “hi”. I want the hi to print only when the bubble that makes the character say it’s initial prompt to be clicked. If I replace hi with starting the events, I basically am done, but I can’t find a way to do that.
When that happens, when I press that button, I want the event to start.
Also here is the gui code:
local event = game.ReplicatedStorage.DialogEvent
local event2 = game.ReplicatedStorage.CloseDialogEvent
event.OnClientEvent:Connect(function()
script.Parent.Dialog.Visible = true
end)
event2.OnClientEvent:Connect(function()
script.Parent.Dialog.Visible = false
end)
I made something incredibly similar to this for the movement system, and it works perfectly.
Well, you can actually do check if Dialog haves “InUse” at true in a LocalScript.
Something like this
local dialog = workspace.NobleHuna.Dialog
seat:GetPropertyChangedSignal("InUse"):Connect(function()
script.Parent.TextLabel.Modal = dialog.InUse
end)
what is seat? Also this is where the NobleNuna actually is lol:
But more importantly, I am planning on making many NPCs with different dialogs, Is there a way to do this without making a ton of scripts or cluttering a single script?
bruh i setted seat, because i am doing something with seats, change it to dialog.
also change dialog value to your thing
You can do workspace:GetDescendants()
and check if one dialog is InUse, then set.
I tried the workspace:GetDescendants
method, and this happened:
Code:
local dialog = workspace:GetDescendants()
for i, v in pairs(dialog) do
if i:IsA("Dialog") and i.Name == "TohungaDialog" then
i:GetPropertyChangedSignal("InUse"):Connect(function()
script.Parent.Dialog.Modal = i.InUse
end)
end
end
Probably me being dumb but it doesn’t work.
Doesn’t work.
you are trying to run :IsA() on a number, try to run :IsA() on v
knew it
I’ve quit studio for too long!
EDIT: doesn’t work
local dialog = workspace:GetDescendants()
for i, v in pairs(dialog) do
if v:IsA("Dialog") and v.Name == "TohungaDialog" then
v:GetPropertyChangedSignal("InUse"):Connect(function()
script.Parent.Dialog.Modal = v.InUse
end)
end
end
no errors
I would personally do something like this:
for _, Dialog in pairs(workspace:GetDescendants()) do
if Dialog:IsA("Dialog") and Dialog.Name == "TohungaDialog" then
Dialog:GetPropertyChangedSignal("InUse"):Connect(function()
script.Parent.Dialog.Modal = Dialog.InUse
end)
end
end
I don’t think Modal is a property of a Dialog, I think it is a property of gui buttons
the text button is named dialog lol.
It also doesn’t work for some reason.
game is singleplayer
Actually, I don’t understand how it works.
local function DialogUsed(Dialog, Value)
script.Parent.Dialog.Modal =
end
for _, Dialog in pairs(workspace:GetDescendants()) do
if Dialog:IsA("Dialog") and Dialog.Name == "TohungaDialog" then
Dialog:GetPropertyChangedSignal("InUse"):Connect(DialogUsed)
end
end
What am I supposed to right there?
oh my code works, I just forgot to turn visible on sorry!
I made a mistake above, I edited my script, that should work ig, I usually use separate functions but reading further into this post you didn’t need much, only modal being toggled I’ve seen by reading, I made my function shorter
using separate functions will sometimes make it more readable when using tons of multiple lines
Well, I was AFK, hope your game works fine! I’ll see the progress.