Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

StreamingEnabled, MouseClick alternative for a local script?

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
3
Answered by 6 years ago

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!

0
You are wonderful callmehbob 54 — 6y
0
Thanks, have a good one. iamnoamesa 674 — 6y
Ad

Answer this question