So basically i have a script that spawns a hat on the players head, Its a image button that sents a remote EVENT [sorry i said function] when clicked and a serverscriptservice script detects it and places the accessory on the player. I got 2 friends to check it out and it turns out only 1 of us can wear the hat at a time, any attempts to have multiple will result in the hat spawning somewhere off the map unanchored and falling into the void.. How do i fix this? serverscriptstorage script below. Tell me if you need the startergui script.

local Event = game.ReplicatedStorage.Hats
local hhalo = Instance.new("Accessory")
hhalo.Name = "HolyHalo"

Event:WaitForChild("Halo").OnServerEvent:Connect(function(Player)
	local workspaceplr = game.Workspace:FindFirstChild(Player.Name)
	local handle = Instance.new("Part")
	handle.Name = "Handle"
	handle.Size = Vector3.new(1,1.6,1)
	handle.Parent = hhalo
	
	local faceFrontAttachment = Instance.new("Attachment")
	faceFrontAttachment.Name = "FaceFrontAttachment"
	faceFrontAttachment.Position = Vector3.new(0,-1,-0.70)
	faceFrontAttachment.Parent = handle
	
	local mesh = Instance.new("SpecialMesh")
	mesh.Name = "Mesh"
	mesh.Scale = Vector3.new(1.2,1.3,1.2)
	mesh.MeshId = "rbxassetid://3932351803"
	mesh.TextureId = "http://www.roblox.com/asset/?id=3770286183"
	mesh.Parent = handle
	
	workspaceplr.Humanoid:AddAccessory(hhalo)
end)


2 comments

0

Wait, if it's a remote function, then how is it OnServerEvent, it's suppoed to be OnServerInvoke.

0

Oh sorry Remote event