Ad
Log in to vote
4

Why the part material not chaged be to plastic?

Asked by 14 days 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 1095 — 14d
2
^w^ RektwayYTB 77 — 14d
2
^w^ imKirda 3167 — 14d
2
^w^ Changed is an event, just access the Material of the part instead Omq_ItzJasmin 519 — 14d

2 answers

Log in to vote
4
Answered by
Xapelize 1095 Moderation Voter
14 days 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 — 13d
0
no problem ^w^ Xapelize 1095 — 13d
Ad
Log in to vote
3
Answered by 14 days 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 519 — 14d
1
Nice code! I didn't thought of that! Thanks for your answer! Xapelize 1095 — 14d
1
Why are you adding in code to check for a humanoid? It's unneeded. SteamG0D 1593 — 14d

Answer this question