Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

filtering enabled making breaking my script?

Asked by 6 years ago
Edited 6 years ago

now this is the script

local debounce = false

function onTouch(hit)
if hit == nil then return end
if hit.Parent == nil then return end
if not game.Workspace:FindFirstChild("Home"..hit.Parent.Name) then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil and debounce == false then
debounce = true
local b = script.Parent.Parent:Clone()
b.Parent = game.Lighting
b.Name = "Home"..hit.Parent.Name
wait(.4)
script.Parent.Parent.Ay.Value = hit.Parent.Name
script.Parent.Head:Remove()
script.Parent.Parent["Home: Nobody"].Name = "Home: "..hit.Parent.Name
script.Parent.Parent.Parent.Name = "Home"..hit.Parent.Name
end
else
end
wait(3)
debounce = false
end

script.Parent.Head.Touched:connect(onTouch)

how do I make this a local script so it works on filtering enabled

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
6 years ago

Renaming:

Renaming a property via localscript will not be recognized by the server. Instead, you can use a RemoteFunction to send the server a request to rename that.

Then, a serverscript will contain the code to rename that certain part, like so.

rS = game:GetService('ReplicatedStorage')
Rename = rS.renameFunction

Renamer = function(player, Item, Name) --first argument MUST define the player
    Item.Name = tostring(Name)
end

Rename.OnServerInvoke = Renamer

Now, in a localscript.

rS = game:GetService('ReplicatedStorage')
rS.renameFunction:InvokeServer(script.Parent.Parent.Parent, "Home"..hit.Parent.Name)

Something like that, at least.

Changing parents also require remotefunctions/events.

Sorry for the vague answer, by the way.

Good luck!

0
Also, I assumed you already made a remotefunction. I like doing that. Fifkee 2017 — 6y
Ad

Answer this question