So, i have a problem with one of my surface gui and image label. Let me explain the situation. The player has an item which, when tool.Activated, spawn a part in front of him. The particular thing is, it spawns locally, with a local script. Linked to this part, and also locally, a surface gui with a button. The button doesn’t work when the player try to press it. I already looked at google and saw some solutions like: there should be no part (even slightly) in front of the Surface obviously, also the Surface should be on PlayerGui with the adornee set to the part. But even with these things set, the button doesn’t want to print the word « Worked ». As the 3 lines of codes are simple, i also didn’t make a mistake about the code.
Anyone got an idea? I could think of the possibility that the part should « exist » in the view of the server and the surface should be displayed on a part created by the server but i am not sure about this.
you can make it so
tool.Activated
then fire a remote event to a server then
in the server script make a part in front of the player and put a surface gui this should probably work
Yes it should work but as it will display the player’s stats, i don’t want everyone to see the book opened. This is also the reason why the part spawns locally and not via a remote event.
Yes. The code is:
local btn = script.Parent
btn.MouseButton1Click:Connect(function()
print(« Worked »)
end)
As i am not in front of my pc but in mobile, i maybe did a mistake but i think this is how i wrote it. Also i am not a beginner, i would know if i did a mistake with this simple script.
It would also be helpful to see the setup of the tool, the surface gui, and the button in the explorer after you spawned the part with the tool. The code that handles tool.Activated would also be useful to see
The part spawn properly in front of the player as the adornee is set properly too because i can see the Surface on the part. And i tried it many times, it does work every time i activate it. But the case button still is an issue @heII_ish
Alright so, i found the issue. When you have a SurfaceGui adornee’d (idk if this word exist) to a part inside character’s model, you can’t click the button. The mistake was then the parent of the part which have the SurfaceGui.