workspace.Model.Humanoid.Died:connect(function()
for i=1, 10 do
local pickup = game.ReplicatedStorage.Xpbrick:Clone()
local num = math.random(1, 3)
local num2 = math.random(1, 2)
pickup.Parent = workspace
pickup.Position = workspace.Model.Head.Position
pickup.Velocity = Vector3.new(math.random(-50, 50), -50, math.random(-50, 50))
if num == 1 then
pickup.BillboardGui.ImageLabel.ImageColor3 = Color3.new(1, 1, 1) -- fuel
elseif num == 2 then
pickup.BillboardGui.ImageLabel.ImageColor3 = Color3.new(0, 0, 1) -- hp
elseif num == 3 then
pickup.BillboardGui.ImageLabel.ImageColor3 = Color3.new(0, 0.55, 1) -- ammo
end
local light = Instance.new('PointLight', pickup)
light.Color = pickup.BillboardGui.ImageLabel.ImageColor3
if num2 == 1 then
pickup.BillboardGui.ImageLabel.Rotation = 0
else
pickup.BillboardGui.ImageLabel.Rotation = 180
end
pickup:BreakJoints()
pickup.Touched:connect(function(hit)
print'dood'
if hit.Parent and hit.Parent:FindFirstChild('Humanoid') then
if num == 2 and hit.Parent.Humanoid.Health < hit.Parent.Humanoid.MaxHealth then -- hp
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health + 1.5
pickup:Destroy()
elseif num == 1 and hit.Parent.Humanoid.Fuel.Value < 100 then -- fuel
hit.Parent.Humanoid.Fuel.Value = hit.Parent.Humanoid.Fuel.Value + 4
pickup:Destroy()
elseif num == 3 and hit.Parent.Humanoid.bullets.Value < hit.Parent.Humanoid.maxbullets.Value then -- ammo
hit.Parent.Humanoid.bullets.Value = hit.Parent.Humanoid.bullets.Value + 1
pickup:Destroy()
end
end
end)
end
workspace.Model:Destroy()
end)
SOLVE EDIT: destroying the model destroyed the script which is why the function didnt respond
If I move this script into the model that's this is referring too, it works the same, except one thing...
The Touched function doesn't respond at all if i touch any of the pickups (doesn't print either), anyone got any idea why its not responding?

7 comments
http://wiki.roblox.com/index.php?title=API:Class/LocalScript
Refer to "In order for a LocalScript to function."
Localscripts cannot function in Workspace.
local scripts work in workspace for me doe...
No, they don't.
They do, I ain't gonna argue with you guys, I know it does for me, And you can't decide what I see.
It works in studio because studio is run in offline mode, and in offline mode the client and server is merged.