Hello!
I want to make a script that kicks the player and gives a badge but its not working can anyone tell me what the problem is?
Its a local script and its in StarterGUI
local player = game.Players.LocalPlayer
local Open = workspace.Part
local opened = false
local BadgeService = game:GetService("BadgeService")
local id = 2141298210
Open.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
wait(2)
script.Parent.ScreenGui.Frame.Visible = true
game.Workspace["Fire sound"]:Stop()
game.Workspace.Static:Play()
wait(8)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552596648"
wait(0.5)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552673778"
wait(0.1)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552596648"
wait(0.1)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552673778"
wait(0.1)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552596648"
wait(0.1)
script.Parent.ScreenGui.Frame.Label.Image = "rbxassetid://12552673778"
if not BadgeService:UserHasBadgeAsync(player.UserId, id) then
BadgeService:AwardBage(player.UserId, id)
wait(0.1)
player:Kick("???")
end
end
end)
Does it give a badge, does the image change? I think you might need to use remote events for badges. P.S don’t use wait(), instead use task.wait() because wait() is deprecated.
For example make a remoteevent in replicated storage, and make a script in scriptservice. Put in this localscript remoteevent:FireServer() and on the other script ``
remoteevent.OnServerEvent:Connect(function()
if not BadgeService:UserHasBadgeAsync(player.UserId, id) then
BadgeService:AwardBage(player.UserId, id)
end
end)
From my experience, there were moments where my scripts had errors but it wouldn’t show up in the output tab.
It could also be the same case for this one although I find it weird how it wouldn’t
This problem seems very similar to a problem another fellow had a few days ago (which i tried to help with)
the badge giving ended up working OUTSIDE of the game, as in, in the actual game instead of roblox studio. you should read the whole post to see if it helps.