So I have a question. In StarterGui there is GUI called "Notifications" and inside of that GUI there is Frame called"BadgeAwardNotifcation" also I have Part in Workspace. That part has script inside. Script code is:
local frame = script.Parent.Parent.Notifications.BadgeAwardNotifcation function onTouched(hit) frame:TweenPosition(UDim2.new(1, -200,0.92, -68)) wait(5) frame:TweenPosition(UDim2.new(1, 100,0.92, -68)) end script.Parent.Touched:connect(onTouched)
What do I need to do that on touch the GUI worked properly?
If your filtering is enabled you cant access to player's playergui from server normal script. But if you want to do that, you need to use remote events. For first put in ReplicatedStorage a RemoteEvent. Then type this first code into your brick script:
local Event = game:GetService('ReplicatedStorage'):WaitForChild('Your Event Name') -- put here your event name that you put in rep storage local Ready = true function OnTouched(hit) if ready == true then -- Using debounce to prevent hit spam if hit.Parent:FindFirstChild('Humanoid') then -- checking if hit author is player(not brick) ready = false local Player = game.Players:GetPlayerFromCharacter(hit.Parent) Event:FireClient(player) -- Sending to player information that his hit the brick wait(5) ready = false end end end) script.Parent.Touched:Connect(OnTouched)
Now insert a localscript into starterGui and type in this code
local Frame = script.Parent.Notifications..BadgeAwardNotifcation local Event = game:GetService('ReplicatedStorage'):WaitForChild('Your Event Name') --put here your event name again Event.OnClientEvent:Connect(function() --firing when player hit the brick frame:TweenPosition(UDim2.new(1, -200,0.92, -68)) wait(5) frame:TweenPosition(UDim2.new(1, 100,0.92, -68)) end)