XDify01
(XDify01)
April 16, 2021, 4:54pm
#1
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I need something like this:
Player clicks on a TextBox
Player died when the TextBox is still focussed
Player respawned **but the TextBox will still be focused until the player wants to release the focus)
What is the issue? Include screenshots / videos if possible!
I can’t really think on how would I make one…
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
You can use CaptureFocus
to make the client be focused on the Textbox when they’re dead.
Try setting it up so when your character dies, it keeps you focused on the specified textbox by recapturing your focus.
majdTRM
(majdTRM)
April 16, 2021, 4:58pm
#3
Have you tried turning off ResetOnSpawn
in your ScreenGui?
1 Like
XDify01
(XDify01)
April 16, 2021, 5:00pm
#4
I do know CaptureFocus exists, but didn’t really know when to capture it, but I’ll try to write the code based on what you suggested.
XDify01
(XDify01)
April 16, 2021, 5:00pm
#5
It is off, and it’s not related.
1 Like
majdTRM
(majdTRM)
April 16, 2021, 5:02pm
#6
Try using capturefocus on Player.CharacterAdded
XDify01
(XDify01)
April 16, 2021, 5:07pm
#7
Thanks to @majdTRM and @EmbatTheHybrid for helping me, in the end it seems like I made a working code:
(note: i parented the localscript containing this code under the textbox instance)
game:GetService("Players").LocalPlayer.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").Died:Connect(function()
wait(game:GetService("Players").RespawnTime)
script.Parent:CaptureFocus()
end)
end)
3 Likes
majdTRM
(majdTRM)
April 16, 2021, 5:08pm
#8
I was more of thinking to use CharacterAdded instead of Died, but actually I think that works as well.
But I would replace CharacterAdded with PlayerAdded instead
XDify01
(XDify01)
April 16, 2021, 5:10pm
#9
PlayerAdded only fires when the player was added, this would result the code to only work 1 time, using CharacterAdded fires the code everytime the character was added to the player, which would allow it to always work correctly as intended
majdTRM
(majdTRM)
April 16, 2021, 5:11pm
#10
Oh nvm, I see what you mean. (humanoid is replaced on death)
1 Like
Anytime! If you have anymore isuses don’t be afraid to make another post!
2 Likes