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

Why Does This Client-Sided Script for Hovering Over a Button Not Work with FilteringEnabled?

Asked by
8391ice 91
7 years ago
Edited 7 years ago

I have a SurfaceGui that is deposited into the player's PlayerGui and adorned to a part in the Workspace.** When I test it in the Studio, the image changes just fine, but in a server, nothing happens! Since the gui is client-sided, shouldn't this work?** I'm pretty new to FilteringEnabled, so there may be much that I need to learn.

This is my script, which is in the SurfaceGui of the PlayerGui.

debounce = false

script.Parent.MouseLeave:connect(function()
    if debounce == false then
        debounce = true
        script.Parent.Image = "http://www.roblox.com/asset/?id=615227711"
    end
    debounce = false
end)

script.Parent.MouseEnter:connect(function()
    if debounce == false then
        debounce = true
        script.Parent.Image = "http://www.roblox.com/asset/?id=615242781"
    end
    debounce = false
end)

At the start of the game, this SurfaceGui is deposited into the Player's PlayerGui and then adorned to a part via this RemoteEvent in the Workspace.

script.SetAdornee.OnServerEvent:connect(function(player)
    local p = game.Players:WaitForChild(player.Name, 10)
    local findGui = p:WaitForChild("PlayerGui", 10)
    local giveGui = game.ServerStorage.Gui.TitleGui:Clone()
    giveGui.Parent = findGui
    giveGui.Adornee = game.Workspace.StartMenuArea.Classroom.Board
end)

This LocalScript in the StarterPack fires the RemoteEvent at the start of the game.

player = game.Players.LocalPlayer
game.Workspace.RemoteEvents.SetAdornee:FireServer(player)

Any and all help is most certainly appreciated!

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

ServerScripts can't see a players PlayerGui. GUI's should be completely handled from the client. Set the adornee to the desired part from the client, no need for events to the server.

(If I'm correct you should get an error in your server log while playing in online mode. (Hit f9 to open the console!))

0
I created a script that sets the Adornee to the part from the client, but when I hover the mouse over the button, nothing happens still. I've also checked the developer console and nothing showed up. Why is this? 8391ice 91 — 7y
0
Try adding some print("positionOfPrint") 's inside your script to find out where it does and where it doesn't come. RubenKan 3615 — 7y
Ad

Answer this question