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

Why the part material not chaged be to plastic?

Asked by 3 years ago
script.Parent.Parent.Block.Touched:Connect(function(Part)
    workspace.PartStorage.Part.Changed = Enum.Material.Concrete
end)

ehh, hello ^w^ just make a script and what are me doing after the script has completed ^w^

thanks >w^

2
^w^ Xapelize 2658 — 3y
2
^w^ RektwayYTB 123 — 3y
2
^w^ imKirda 4491 — 3y
2
^w^ Changed is an event, just access the Material of the part instead Omq_ItzJasmin 666 — 3y

2 answers

Log in to vote
4
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

There is no need to make Part for a neutral function. Change to function() instead.

I think you meant why is the part is plastic? Easy fix. Consider replacing . Changed to . Material instead.

Need a script?

script.Parent.Parent.Block.Touched:Connect(function()
    workspace.PartStorage.Part.Material = Enum.Material.Concrete
end)
0
thanks you so much ^w^ RizkySugihartoYT 36 — 3y
0
no problem ^w^ Xapelize 2658 — 3y
Ad
Log in to vote
3
Answered by 3 years ago

A I can see, You should Change function(Part) into function(hit)

The hit function is activated, When the player is touching it's part. I will show the script:

script.Parent.Parent.Block.Touched:Connect(function(hit)
       local h = hit.Parent:FindFirstChild("Humanoid") -- Humanoid
       if h ~= nil then
             Workspace.PartStorage.Part.Material = Enum.Material.Concrete
       end
end)

Here is some errors:

First of all, .Changed is an event which Activated when something changes

Second, Workspace starts with Capital W, Workspace.


And Please Note: This is a script for Humanoids [Players or NPCs] Which has Humanoid. This doesn't work Unless the Humanoid is not Parented to the Object which needs to Touch.

I hope it Help!

1
Actually, using "Workspace" with the capital 'W' is deprecated. "workspace" is the correct variable, with a lowercase 'W' Omq_ItzJasmin 666 — 3y
1
Why are you adding in code to check for a humanoid? It's unneeded. SteamG00B 1633 — 3y

Answer this question