I am trying to copy a GUI from a brick to a player. In means of trying to keep it modular, being able to easily change values without going through scripts, I am using int values and string values. In studio my script works, however in online mode the output window is telling me that the values I'm trying to access in the script isn't a valid member of the GUI? I have other values that are found that are attached to buttons and frames, but the two that are directly under GUI have been causing me problems. Do I have to relocate them in the hierarchy to be in a frame?
--current local button = script.Parent local selectedClass = script.Parent.Parent.Parent.PreviewGui:WaitForChild("SelectedClass")--SelectedClass.Value local selectedChar = script.Parent.Parent.Parent.PreviewGui:WaitForChild("SelectedChar") local thisClass = script.Parent.Parent.Int.Value local thisChar = script.Parent.Parent.Title.Value function MouseOver() local sound = Instance.new("Sound") sound.SoundId = "http://www.roblox.com/asset?id=341970310" sound.Volume = 1 sound.Pitch = 1 sound.Parent = game.Players.LocalPlayer.PlayerGui sound:Play() wait() sound:remove() end -- function onClicked() --Play a sound local sound = Instance.new("Sound") sound.SoundId = "http://www.roblox.com/asset?id=341992923" sound.Volume = 10 sound.Pitch = 1 sound.Parent = game.Players.LocalPlayer.PlayerGui sound:Play() wait() sound:remove() --Pick the Class selectedClass.Value = tostring(thisClass) selectedChar.Value = tostring(thisChar) --thisChar end function getName() local findName = script.Parent.Parent.Title.Value -- a class type of StringValue within the overall Frame return findName end print("getName() is "..getName()) script.Parent.Text = getName() script.Parent.MouseEnter:connect(MouseOver) button.MouseButton1Click:connect(onClicked)
The problem I was having was related to using LocalScript over Script.