Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Clone in item and attach it to player, help?

Fout = 2
Flag = game.ServerStorage.Flag
Giver = game.Workspace.FlagGiver

function giveFlag(part)
local parent = part.parent
	if game.Players:GetPlayerFromCharacter(parent) and Fout == 2 then
		local OPFlag = Flag:Clone()
		OPFlag.Parent = workspace
		OPFlag.Position = -- What I need help on.
		Fout = 1
	end
end

Giver.Touched:connect(giveFlag)

I'm planning to connect the item to the player with a weld once it's been spawned in, though if anyone has a better pay of doing that it'd also be greatly appreciated, but the main part is getting is to spawn in at the players position, help please?

1 answer

I HOPE THIS HELPS!!!! :


Fout = 2
local Flag = game.ServerStorage.Flag -- i would use a local JIC
local Giver = game.Workspace.FlagGiver
local Position = Character.HumanoidRootPart.Position

function giveFlag(part)
local parent = part.parent
    if game.Players:GetPlayerFromCharacter(parent) and Fout == 2 then
        local OPFlag = Flag:Clone()
        OPFlag.Parent = workspace
        OPFlag.Position = Position -- What I dont need help on anymore
        Fout = 1
    end
end

Giver.Touched:connect(giveFlag)

2 comments

0

Studio doesn't understand what's meant by Character.

0

Try using the torso pposition(so like game.workspace.player(i forgot what it is, its somthing like player but probebly mess aroud with the word player).Torso

This discussion is preserved as it was. New answers, comments, and votes are closed.