|
| 18 Dec 2015 08:31 PM |
local player = script.Parent.Parent function onTouched(hit) player.Name = "touched" wait(5) end script.Parent.Touched:connect(onTouched)
I wanna make it so when they touch the brick there name is touched. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 08:36 PM |
| nothing, if you want script.Parent.Parent's name to change to 'touched' |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 08:37 PM |
script.Parent.Touched:connect(function(h)pcall(function()h.Parent.Archivable=true;h.Parent.Name='touched'end)end)
#code Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs) |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 08:39 PM |
| Idk how to call the player lol and sensei, I can not really read it like that. |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Dec 2015 09:09 PM |
I made this if anyone wants to utilize it. It's powerful. Haven't tested it and it is strongly subject to improvement... just a prototype too :)
--
local flagger = {}
flagger.case = function(model, method, exec)
local core = model:GetChildren()
local flag = function(...) exec(...) end
local flags = {}
for i, v in pairs(core)do table.insert(flags, v[method]:connect(function(a, b) flag(v, model, a, b) end)) end
return setmetatable({Flags = flags, disconnect = function(self) while(#self.Flags > 0)do local item = table.remove(self.Flags, 1) item:disconnect() end end})
end
return flagger
-- test case
flagger.case(game.Workspace.model, "Touched", function(listen, model, hit)
print(listen.Name, "has been touched by", hit.Name)
end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Dec 2015 09:28 PM |
You supply a model, the target event, and a function which accepts the parameters. It will generate a table of events, which since it has :disconnect() metatable, can all be stopped at once and removed so you can execute it again. When the specified event happens to a part in the model (expecting the whole model to be parts, because it is prototype), the exec parameters, which is a function, pops with arguments.
Use it and find out more. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2015 09:31 PM |
script.Parent.Touched:connect(function(hit) local character = hit.Parent character.Name = "touched" end) |
|
|
| Report Abuse |
|
|
| |
|
Auzer
|
  |
| Joined: 24 Dec 2011 |
| Total Posts: 1590 |
|
|
| 19 Dec 2015 09:48 AM |
| Replace script.Parent.Parent with game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 10:52 AM |
| Workspace.Smooth Block Model.Script:3: attempt to index upvalue 'player' (a nil value) |
|
|
| Report Abuse |
|
|