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

GUI cloning into every player's PlayerGui instead of individual?

Asked by 8 years ago

I have encountered this problem before. The problem I'm facing is whenever I click on the part with a ClickDetector, the GUI shows up on every player's screen instead of the player who clicked it. This inside of a LocalScript and StarterGui.

shop = game.Players.LocalPlayer.PlayerGui.Shop

frame = shop:WaitForChild("Frame")

exitButton = frame:WaitForChild("ExitShop")

Player = game.Players.LocalPlayer

Alexis = game.workspace.Alexis

Clicker = Alexis.Torso:WaitForChild("ClickDetector")

ShopSound = shop:WaitForChild("ShopSound")
--------------------
Clicker.MouseClick:connect(function(playerWhoClicked)
    ShopSound:Play()
    frame:TweenPosition(UDim2.new(0.5,-250,0.5,-200), "In", "Quint", 0.35, true)
    Player.DevComputerMovementMode = "Scriptable"
end)

--Do stuff when the exit button is clicked
exitButton.MouseButton1Down:connect(function()
    ShopSound:Play()
    frame:TweenPosition(UDim2.new(0.5,-250,0.5,300), "Out", "Quint", 0.35, true)

--Give control back to the player
    Player.DevComputerMovementMode = "UserChoice"
end)
0
This does not have anything on cloning the Gui into a player. Since it's in a LocalScript, this should not affect anyone else. Bad question. Also, use the playerWhoClicked if you're gonna define it. TheDeadlyPanther 2460 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Note: I am a beginner scripter, this will more than likely be incorrect, but maybe. You're making it move, which will move it on everybody's gui, what i do, is if it isnt like a animation to come in, i just make the visible off, and make it visible when they click on it, my solution: If it isn't an animation when it comes in, make it invisible at the start, then change its visible when they click on it.

function onClicked()
if script.Parent.Frame.Visible == true then
    script.Parent.Frame.Visible = false
    else
    script.Parent.Frame.Visible = true
    end
end
script.Parent.Button.MouseButton1Click:connect(onClicked)

Just an example script :)

Ad

Answer this question