It looks like you're using a tool, so I'll assume you are. I found three problems with this code.
First being that when your Handle is touched, anything can be touching it, not just the parts with IntValues. So you should check if hit has an IntValue (named "IntValue") inside of it. We can use FindFirstChild for this!
if hit:FindFirstChild("IntValue") then
end
Next, you're trying to use the Changed event incorrectly. The event can only be used on objects that you can view in the Explorer, like Workspace or a Part. Also, the argument given in changed is the name of the property that was changed. We can just set the gui's text value to the IntValue's Value though.
hit.IntValue.Changed:connect(function()
end)
And finally, when a player equips a tool it is moved to their Character. You seem to be trying to get the player using Parents, which doesn't work. Instead you can use the GetPlayerFromCharacter method on the tool's parent.
game.Players:GetPlayerFromCharacter(script.Parent.Parent)
Then just do what you were doing before (mostly), set the text of your GUI.
game.Players:GetPlayerFromCharacter(script.Parent.Parent).PlayerGui.ScreenGui.TextBox.Text = hit.IntValue.Value
1 comment
Next time try to have your title match what your asking, "GUI and IntValue" doesn't help us know what your asking.