script.Parent.Touched:connect(function(hit) local h=hit.Parent:findFirstChild("Humanoid") if h~=nil then game.Players.LocalPlayer.PlayerGui.Minigame.Enabled=true end end)
When I touch the part it says :attempt to index field 'LocalPlayer' (a nil value)
You can only use Players.LocalPlayer in a localscript.
Changes to the GUI are probably also best made in a localscript, as the GUI is a local object.
Localscripts do not work in Workspace. Even with FilteringEnabled on however, localscripts can still access the Touched event fired when they touch your block.
So the easiest solution is probably to put this code in a localscript and replace script.Parent (at the start) with the location and name of your object (or make a ObjectValue pointing to it if it's deep inside non-uniquely names structures).
The proper way is in the end to communicate between server and client through RemoteEvents, in this example triggered by the touched event on the server and received by the client, so that you can for example also safely register on the server that the player is now allowed to use this GUI.
Hope this helps. Good luck!
try this
script.Parent.Touched:connect(function(hit) local h=hit.Parent:findFirstChild("Humanoid") if h~=nil then game.Players:GetPlayerFromCharacter(h.Parent).PlayerGui.Minigame.Enabled=true end end)
what i did is game.Players:GetPlayerFromCharacter(h.Parent) this searches for a player with that character