Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

StreamingEnabled, MouseClick alternative for a local script?

From my understanding, MouseClick is what is not kapeeshing with StreamingEnabled. Is there a different variable that works with Click Detectors? Or do I have a different problem? (This is a localscript that's stored in the StarterGUI, waiting for an object to be clicked on in the workspace)

player = game.Players.LocalPlayer

function onClicked()
	player.PlayerGui.GUI.PageOne.Visible = true
end

game.Workspace.clothing2.ClickDetector.MouseClick:connect(onClicked) 

Another question - I have local parts that spawn on a click of a GUI button, that seem to only spawn with MouseButton1Down (but does not work now with StreamingEnabled). Is there a variable that is known for working with local parts spawn that also works with StreamingEnabled/FE?

Thank you!

1 answer

✓ Accepted answer

Streaming Enabled should not affect server sided scripts, to my understanding. The way click detectors are, you can simply have a server sided script in which detects when a player clicks them. I would recommend using a remote event for this, which fires the client when needed to. Here is what I mean; a script inside the click detector:

local remote = game.ReplicatedStorage.GuiRemote -- Change the name to whatever you name it
script.Parent.MouseClick:Connect(function(Player)
	remote:FireClient(Player)
end)

Then, a local script under StarterGui:

local remote = game.ReplicatedStorage.GuiRemote -- Change the name to whatever you name it
remote.OnClientEvent:Connect(function()
	player.PlayerGui.GUI.PageOne.Visible = true
end)

This way, you would have no issues with either FE or SE. Now, for your next question. MouseButton1Down does NOT work with streaming enabled. Please use the Button1Down event instead. To read more about streaming enabled, visit this link -- Have a good day, and please accept my answer if helpful!

2 comments

0

You are wonderful

0

Thanks, have a good one.

This discussion is preserved as it was. New answers, comments, and votes are closed.