Been trying to figure out a way to clone and object from serverstorage and have it appear in workspace when you join a game, here is what i’m working with but any time i test it, it does not work.
Can someone help me out?
local player = game.Players.LocalPlayer
local bs = game:GetService("BadgeService")
game.Players.PlayerAdded:Connect(function()
local badgeId = 2126669305
if bs:UserHasBadgeAsync(player.UserId,badgeId) then
game.ServerStorage.Statue:Clone().Parent = game.Workspace
print("test")
end
end)
Maybe try this?
Put this code in a script in ServerScriptService
local players = game:GetService("Players") -- normal scripts cant use LocalPlayer; It's localscript exclusive.
local bs = game:GetService("BadgeService")
players.PlayerAdded:Connect(function(plr) -- you can get the localplayer in a script easily via this exact function instead
local badgeId = 2126669305
if bs:UserHasBadgeAsync(plr.UserId, badgeId) then
game.ServerStorage.Statue:Clone().Parent = workspace
print("test")
end
end)